TrzSelectFolderDialog Sort Option?

Home Forums Konopka Signature VCL Controls (formerly Raize Components) TrzSelectFolderDialog Sort Option?

Viewing 1 reply thread
  • Author
    Posts
    • #2550
      Monte Etherton
      Participant

        Is there a way to set the folder sort, for example to date modified?

        thanks in advance, Ray !

        -Monte

      • #2553
        Ray Konopka
        Keymaster

          You can affect the sorting of the ShellTree used by the RzSelectFolderDialog component by do a little bit of a hack. For example,

          uses
            RzShellFolderForm;
          
          procedure TForm13.RzButton1Click(Sender: TObject);
          begin
            RzSelectFolderDialog1.Execute;
          end;
          
          function CustomSortProc(Node1, Node2: TTreeNode; Data: Integer): Integer; stdcall;
          begin
            Result := -AnsiStrIComp(PChar(Node1.Text), PChar(Node2.Text));
          end;
          
          procedure TForm13.RzSelectFolderDialog1FormShow(Sender: TObject);
          begin
            TRzSelectFolderForm( RzSelectFolderDialog1.Form ).ShellTree.CustomSort(@CustomSortProc, 0);
          end;

          This example will reverse sort the nodes in the Shell Tree.

          The problem is that there is no simple way to get at the information you want to sort on. That is, the date modified. That information is not tracked with each node in the Shell Tree. You may be able to do some other lookup to get the information you need, then you could modify the CustomSortProc function to sort by modified date.

          Ray

      Viewing 1 reply thread
      • You must be logged in to reply to this topic.