2013년 1월 18일 금요일

ShellListView 에서 필터 구현하기

ShellListView 컴포넌트는 델파이 샘플프로그램에 있으니 설치하면 됩니다.

저의 경우에는
C:\Users\Public\Documents\RAD Studio 9.0 Samples\Delphi\VCL\ShellControls
에 있습니다.

폼에 FilterComboBox 와 ShellListView 컴포넌트를 올려 놓습니다.


unit Unit2;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.FileCtrl, Vcl.ExtCtrls, Vcl.ComCtrls, Vcl.Shell.ShellCtrls;

type
  TForm2 = class(TForm)
    ShellListView1: TShellListView;
    Panel1: TPanel;
    Label1: TLabel;
    Edit1: TEdit;
    Button1: TButton;
    FilterComboBox1: TFilterComboBox;
    procedure ShellListView1AddFolder(Sender: TObject; AFolder: TShellFolder;
      var CanAdd: Boolean);
    procedure FilterComboBox1Change(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form2: TForm2;

implementation

{$R *.dfm}

procedure TForm2.FilterComboBox1Change(Sender: TObject);
begin
  ShellListView1.Refresh;
end;

procedure TForm2.ShellListView1AddFolder(Sender: TObject; AFolder: TShellFolder;
  var CanAdd: Boolean);
var xFilterExt, xExt : string;
begin
  if FilterComboBox1.Mask <> '*.*' then begin
    xFilterExt:= ExtractFileExt(FilterComboBox1.Mask);
    xExt:= ExtractFileExt(AFolder.PathName);
    if (CompareText(xExt, xFilterExt) = 0) or AFolder.IsFolder then
      CanAdd:= True
    else
      CanAdd:= False;
  end;

end;

end.

댓글 없음:

tensorflow gpu 사용하기에서

 tensorflow 설치시 주의해야 한다. # Anything above 2.10 is not supported on the GPU on Windows Native python - m pip install "tensorflow<2.11...