Shelltreeview

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #35698
    Dennis445
    Participant

    Hello

    Is there a method for filtering file in a shelltreeview for example only showing .exe or .ini?

    #50382
    CheshireCat
    Participant

    Hello,

    try this:

    Code:
    procedure TForm1.sButton1Click(Sender: TObject);
    begin
    sShellListView1.Mask := '*.exe;*.ini';
    end;

    I hope you mean ShellListView instead ShellTreeView 🙂

    #50383
    Dennis445
    Participant

    Thanks for the reply however I do need it for shelltreeview.

    #50384
    CheshireCat
    Participant

    maybe it works with the method AddFolder …

    Code:
    procedure TForm1.sShellTreeView1AddFolder(Sender: TObject;
    AFolder: TacShellFolder; var CanAdd: Boolean);
    var
    Ext: string;
    const
    Mask = '.exe';
    begin
    Ext := ExtractFileExt(AFolder.DisplayName(seSystem));
    CanAdd := AFolder.IsFolder or (CompareText(Mask, Ext) = 0);
    end;
    #50385
    Dennis445
    Participant

    That works, thank you.

    I also want to add that with your code if I wanted to have multiple ext in the tree I extended the “or”

    Mask[0] := '.exe';

    Mask[1] := '.ini';

    CanAdd := AFolder.IsFolder or (CompareText(Mask[0], Ext) = 0) or (CompareText(Mask[1], Ext) = 0);

    is this the best way to have several file types show?

    #50388
    CheshireCat
    Participant
    'Dennis445' wrote:

    … is this the best way to have several file types show?

    I think this is the best way 🙂

    #50389
    Dennis445
    Participant

    Thank you, I very much appreciate the advice.

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.