-
Notifications
You must be signed in to change notification settings - Fork 41
/
Copy pathuForm2.pas
117 lines (102 loc) · 2.73 KB
/
uForm2.pas
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
unit uForm2;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.ListView.Types, FMX.ListView.Appearances,
FMX.ListView.Adapters.Base, FMX.Controls.Presentation, FMX.StdCtrls, FMX.Layouts, FMX.ListView, FMX.Edit, FMX.EditBox,
FMX.SpinBox;
type
TForm2 = class(TForm)
ListView1: TListView;
Layout1: TLayout;
Layout2: TLayout;
Label2: TLabel;
Switch1: TSwitch;
Layout3: TLayout;
cbShowScrollBar: TCheckBox;
cbMakeSelect: TCheckBox;
Layout4: TLayout;
cbSearch: TCheckBox;
cbStyled: TCheckBox;
StyleBook1: TStyleBook;
Layout5: TLayout;
Label3: TLabel;
sbBottom: TSpinBox;
Layout6: TLayout;
Label1: TLabel;
sbTop: TSpinBox;
procedure Switch1Switch(Sender: TObject);
procedure cbShowScrollBarChange(Sender: TObject);
procedure cbMakeSelectChange(Sender: TObject);
procedure cbSearchChange(Sender: TObject);
procedure cbStyledChange(Sender: TObject);
procedure sbBottomChange(Sender: TObject);
procedure sbTopChange(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.fmx}
procedure TForm2.cbMakeSelectChange(Sender: TObject);
begin
ListView1.MakeSelectedItemVisible := cbMakeSelect.IsChecked;
end;
procedure TForm2.cbSearchChange(Sender: TObject);
begin
ListView1.SearchVisible := cbSearch.IsChecked;
end;
procedure TForm2.cbShowScrollBarChange(Sender: TObject);
begin
ListView1.ShowScrollBar := cbShowScrollBar.IsChecked;
end;
procedure TForm2.cbStyledChange(Sender: TObject);
begin
if cbStyled.IsChecked then
ListView1.StyleLookup := 'listviewstyle_panel'
else
ListView1.StyleLookup := '';
end;
procedure TForm2.FormShow(Sender: TObject);
var
I: Integer;
begin
ListView1.ItemsClearTrue;
for I := 0 to 20 do
begin
with ListView1.Items.Add do
begin
Text := 'Item ' + I.ToString;
Detail := '';
end;
end;
end;
procedure TForm2.sbBottomChange(Sender: TObject);
begin
ListView1.OffsetBottom := trunc(sbBottom.Value);
end;
procedure TForm2.sbTopChange(Sender: TObject);
begin
ListView1.OffsetTop := trunc(sbTop.Value);
end;
procedure TForm2.Switch1Switch(Sender: TObject);
begin
ListView1.Horizontal := Switch1.IsChecked;
if ListView1.Horizontal then
begin
ListView1.ItemAppearance.ItemHeight := 220;
ListView1.ItemAppearance.ItemEditHeight := 220;
ListView1.Height := 120;
end
else
begin
ListView1.ItemAppearance.ItemHeight := 50;
ListView1.ItemAppearance.ItemEditHeight := 50;
ListView1.Height := ClientHeight - Layout1.Height - 20;
end;
end;
end.