I received a question from a customer:
I am trying to find a way to display a grid of files (specifically DBF files) and show them in the order they were created with the dates and file sizes.
I just took the sample code from Add a slider control to your TreeMap to vary how much detail is shown and cut/paste and the result is below.
It uses the AllowCellSelection property which allows the grid to mimic a listbox.
DEFINE CLASS MyForm as Form
AllowOutput=.f. && so '?' output goes to screen
PROCEDURE init(cPath as String, cMask as string, fSubDir as Boolean)
SET EXCLUSIVE OFF
SET SAFETY OFF
SET TALK off
SET EXACT OFF
CREATE table Files (path c(240),fname c(240),fsize n(10,0),timestamp t)
INDEX on timestamp DESCENDING TAG t && choose your desired order
* INDEX on fsize DESCENDING TAG fsize
this.gr.Width = thisform.Width
PROCEDURE DoDir(cPath as String, cMask as String)
FOR i = 1 TO n
INSERT INTO files (Path,fname,fsize,timestamp) VALUES ;
(cPath, aa[i,1], aa[i,2],CTOT(DTOC(aa[i,3])+aa[i,4]))
n=ADIR(aa,cPath+"*.*","HD",1) && now without the mask, search for directories
IF "D"$aa[i,5] && if it's a dir
IF aa[i,1] != '.'
this.DoDir(cPath+aa[i,1]+"\",cMask) && recur