home *** CD-ROM | disk | FTP | other *** search
- /*
- Listing 25.13. Browsing an array of directory information.
- 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 BrowArray2()
- local dir_, element, list, key
-
- // Load the dir_ array with a complete set of
- // directory information for the current subdirectory.
- dir_ := directory()
-
- // This will be our "element pointer".
- element := 1
-
- // General browse setup.
- @ 9, 19 to 20, 61 double
- list := TBrowseNew(10, 20, 20, 60)
- list:headSep := "---"
- list:colSep := " | "
- list:footSep := "---"
-
- // Assign the positioning blocks.
- list:goTopBlock := { || element := 1 }
- list:goBottomBlock := { || element := len(dir_) }
- list:skipBlock := { |n| ArraySkip(len(dir_), @element, n) }
-
- // File name is first element in array.
- list:addColumn(TBColumnNew("File Name", ;
- { || padr(dir_[element, 1], 12) } ))
-
- // Size is second element.
- list:addColumn(TBColumnNew("Size", ;
- { || transform(dir_[element, 2], "999,999,999") } ))
-
- // Date and time are third and forth elements.
- // We'll skip the file attributes in the fifth element.
- list:addColumn(TBColumnNew("Date", { || dir_[element, 3] } ))
- list:addColumn(TBColumnNew("Time", { || dir_[element, 4] } ))
-
- // 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 CHP2513.PRG
-