home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 25.12. Browsing an array of file names.
- Author: Craig Yellick
- Excerpted from "Clipper 5: A Developer's Guide"
- Copyright (c) 1991 M&T Books
- 501 Galveston Drive
- Redwood City, CA 94063-4728
- (415) 366-3600
- */
-
- //───── NOTE: must compile with the /N option!
-
- function BrowArray()
- /*
- Load an array of file names and browse it.
- */
- local files_, element, list, key
-
- // Load the files_ array with filenames
- // found in current subdirectory.
- files_ := {}
- aeval(directory(), { |f_| aadd(files_, f_[1]) } )
-
- // This will be our "element pointer".
- element := 1
-
- // General browse setup.
- list := TBrowseNew(10, 30, 18, 50)
- list:headSep := "-"
- list:footSep := "-"
-
- // Assign the positioning blocks.
- list:goTopBlock := { || element := 1 }
- list:goBottomBlock := { || element := len(files_) }
- list:skipBlock := { |n| ArraySkip(len(files_), @element, n) }
-
- // Add a file name column object to the browse object.
- list:addColumn(TBColumnNew("File Name", ;
- { || padr(files_[element], 12) } ))
-
- // Display the window and process navigation keystrokes.
- do while .t.
- do while .not. list:stabilize()
- enddo
- if .not. Navigate(list, inkey(0))
- exit
- endif
- enddo
- return nil
-
- // end of file CHP2512.PRG
-