1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
|
program filegrid;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}{$ENDIF}
Classes,
fpgfx,
gfxbase,
gui_form,
gui_grid,
gui_checkbox,
gui_button;
type
TMainForm = class(TfpgForm)
private
FGrid: TfpgFileGrid;
chkShowHidden: TfpgCheckBox;
btnQuit: TfpgButton;
procedure chkShowHiddenChanged(Sender: TObject);
procedure btnQuitClicked(Sender: TObject);
public
constructor Create(AOwner: TComponent); override;
end;
{ TMainForm }
procedure TMainForm.chkShowHiddenChanged(Sender: TObject);
begin
FGrid.FileList.ReadDirectory('*', chkShowHidden.Checked);
fpgSendMessage(self, FGrid, FPGM_PAINT);
end;
procedure TMainForm.btnQuitClicked(Sender: TObject);
begin
Close;
end;
constructor TMainForm.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
WindowTitle := 'Filegrid Test';
SetPosition(100, 100, 620, 400);
FGrid := TfpgFileGrid.Create(self);
FGrid.SetPosition(8, 8, 600, 360);
FGrid.FileList.ReadDirectory('*', True);
FGrid.Anchors := [anLeft, anTop, anBottom, anRight];
chkShowHidden := CreateCheckBox(self, 8, Height - 25, 'Show Hidden');
chkShowHidden.Checked := True;
chkShowHidden.OnChange := @chkShowHiddenChanged;
chkShowHidden.Anchors := [anLeft, anBottom];
btnQuit := CreateButton(self, Width - 88, Height - 30, 80, 'Quit', @btnQuitClicked);
btnQuit.ImageName := 'stdimg.Quit';
btnQuit.ShowImage := True;
btnQuit.Anchors := [anRight, anBottom];
end;
procedure MainProc;
var
frm: TMainForm;
begin
fpgApplication.Initialize;
frm := TMainForm.Create(nil);
frm.Show;
fpgApplication.Run;
end;
begin
MainProc;
end.
|