Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sorting in dialogs

Status
Not open for further replies.

December

Programmer
Nov 29, 2002
19
UA
greetings everybody
Does anyone know how to make files be sorted by type (by alphabet, size etc) when TOpenDialog (TSaveDialog) is executed?
 
Maybe something like this will help you to start.

procedure TForm1.Button1Click(Sender: TObject);
var
Filter1, Filter2: string;
test : string;
begin
Filter1 := 'text|.txt';
Filter2 := 'html|.html';

if LeftStr(Filter1,1) < LeftStr(Filter2,1) then // uses strUtils;
OpenDialog1.Filter := Filter1 + '|' + Filter2
else
OpenDialog1.Filter := Filter2 + '|' + Filter1;

if Opendialog1.Execute then
// etc..
end;

PS!
There are a lot of sort methods that it is much better.
Lowercase character have always lower value then uppercase character.

 
Thanks, michaenh, but that's not what I want. I must have expressed myself ambiguity. I have a filter with one type of files, it's OK. Now I'd like to see files sorted by alphabet in the dialog. Is there easy way to do it?
 
Hi December

In the Windows Explorer Window you can choose to arrange icons by name, type, size,date and auto arrange. If you choose one of those and mark out remember each folder's view settings in folder option -> view, then this will sort your files as you request. So will the Dialogs component.

I know that in Delphi6 and 7 there is also a Sample component(ShellListView) where there is a property called sorted. You can just set the property to TRUE then the files and folders in this component will be sorted. I dont know if this will also sort the Dialogs component.

I also dont know if this component follows with the earlier Delphi versions..

The Sample component use a ShellCtrls.pas file.

If you want to make your own code take a look at the file, ShellCtrls.pas file... maybe you can use something from there... .

C:\Program Files\Borland\Delphi(x)\Demos\ShellControls\ShellCtrls.pas

Michael




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top