Board index » delphi » Sort files in TFileListBox by date
Stefan Roeck
![]() Delphi Developer |
Sat, 15 Jun 2002 03:00:00 GMT
|
Stefan Roeck
![]() Delphi Developer |
Sat, 15 Jun 2002 03:00:00 GMT
Sort files in TFileListBox by date
As I got no satisfying answer I'll have another try:
Is there a possibilty to sort files by date. A TFileOpenDialog doesn't help because I want do use the files internally. The files don't have to be drawn to the FileListBox, I only used it to receive the files of a specific directory (so actually, it is not visible!) - I thought of using TSearchRec but I find it quite difficult to understand. Thanx & Ciao, |
Pieter Zijlstr
![]() Delphi Developer |
Sun, 16 Jun 2002 03:00:00 GMT
Re:Sort files in TFileListBox by dateHi Stefan, Here is sample of what I once did. HTH type { TNewStringList } {It's not the fastest sorting algorithm but I couldn't get procedure TNewStringList.Sort; procedure GetAllFiles(Items: TStrings; SearchSpecs: string; Attr: word); procedure TForm1.Button1Click(Sender: TObject); Memo1.Clear; QuoteStefan Roeck wrote: |
Stefan Roec
![]() Delphi Developer |
Sun, 16 Jun 2002 03:00:00 GMT
Re:Sort files in TFileListBox by dateHello Pieter, thanks for your code, it really works fine. My problem now is that I want to sort files not by date of creation but by last file access. I try to use ftLastAccessTime-Property as following: Items.AddObject(SearchRec.Name, But the raises a "invalid conversion"-error(or sth. like that, I have it in Thanks, Pieter Zijlstra <pzijlstr...@freeler.nl> schrieb in im Newsbeitrag: Quote> Hi Stefan, |
Pieter Zijlstr
![]() Delphi Developer |
Mon, 17 Jun 2002 03:00:00 GMT
Re:Sort files in TFileListBox by dateSearchRec.FindData.ftLastAccessTime is actually a structure containing two dwords this will not fit in the Objects part of the stringlist. There are two things you can do write your own type of (string)list capable of storing other info as Objects (for a sample see VCL source files) or convert the ftLastAccessTime to the DOS type of filetimestamp. This can be done by replacing the GetAllFiles procedure with this: procedure GetAllFiles(Items: TStrings; SearchSpecs: string; Attr: word); Note: - Pieter Stefan Roeck wrote Quote> Hello Pieter, Quote
|
2. Files in TOpenDialog sorted by date?
3. Most efficient sort text file routine, sort algorithms
4. D3: Determine total number of files in TFilelistBox???
5. Most efficient sort text file routine, sort algorithms
6. TFileListBox shows .html files twice when filter set to *.htm;*.html
7. Why I can't select all files in the TFileListBox