-
Notifications
You must be signed in to change notification settings - Fork 41
/
uForm1.pas
138 lines (119 loc) · 3.99 KB
/
uForm1.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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
unit uForm1;
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.Edit, FMX.EditBox, FMX.SpinBox, FMX.Controls.Presentation,
FMX.StdCtrls, FMX.Layouts,
FMX.ListView, FMX.Objects;
type
TForm1 = class(TForm)
ListView1: TListView;
Layout1: TLayout;
Label1: TLabel;
Image1: TImage;
Button1: TButton;
Layout2: TLayout;
Label2: TLabel;
Switch1: TSwitch;
cbTransSepar: TCheckBox;
cbTransItems: TCheckBox;
cbTransBackg: TCheckBox;
procedure ListView1ButtonClick(const Sender: TObject; const AItem: TListItem;
const AObject: TListItemSimpleControl);
procedure Button1Click(Sender: TObject);
procedure Switch1Switch(Sender: TObject);
procedure ListView1UpdatingObjects(const Sender: TObject; const AItem: TListViewItem; var AHandled: Boolean);
procedure FormShow(Sender: TObject);
procedure ListView1ApplyStyleLookup(Sender: TObject);
procedure cbTransBackgChange(Sender: TObject);
procedure cbTransItemsChange(Sender: TObject);
procedure cbTransSeparChange(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.fmx}
uses FMX.ListView.TextButtonFix;
procedure TForm1.Button1Click(Sender: TObject);
begin
ListView1.SetColorItemSelected(TAlphaColorRec.Orangered);
ListView1.SetColorItemFill(TAlphaColorRec.Whitesmoke);
ListView1.SetColorItemFillAlt(TAlphaColorRec.Lightgrey);
ListView1.SetColorBackground(TAlphaColorRec.Whitesmoke);
ListView1.SetColorItemSeparator(TAlphaColorRec.Red);
ListView1.SetColorText(TAlphaColorRec.Darkmagenta);
ListView1.SetColorTextSelected(TAlphaColorRec.Blueviolet);
ListView1.SetColorTextDetail(TAlphaColorRec.Darksalmon);
ListView1.SetColorHeader(TAlphaColorRec.Crimson);
ListView1.SetColorTextHeader(TAlphaColorRec.Whitesmoke);
ListView1.SetColorTextHeaderShadow(TAlphaColorRec.grey);
end;
procedure TForm1.cbTransBackgChange(Sender: TObject);
begin
ListView1.Transparent := cbTransBackg.IsChecked;
end;
procedure TForm1.cbTransItemsChange(Sender: TObject);
begin
ListView1.TransparentItems := cbTransItems.IsChecked;
end;
procedure TForm1.cbTransSeparChange(Sender: TObject);
begin
ListView1.TransparentSeparators := cbTransSepar.IsChecked;
end;
procedure TForm1.FormShow(Sender: TObject);
var
I: Integer;
AItem: TListViewItem;
begin
ListView1.ItemsClearTrue;
for I := 0 to 20 do
begin
AItem := ListView1.Items.Add;
with AItem do
begin
if I mod 11 = 0 then
begin
Text := 'Header';
Purpose := TListItemPurpose.Header;
end
else
begin
Text := 'Item Random ' + I.ToString;
Detail := 'Detail for ' + Text;
ButtonText := 'Custom Color';
Bitmap := Image1.Bitmap;
end;
end;
ListView1.Adapter.ResetView(AItem); // fix TextButton ( TListViewTextButtonFix )
end;
end;
procedure TForm1.ListView1ApplyStyleLookup(Sender: TObject);
begin
ListView1.SetColorPullRefresh(TAlphaColorRec.Lime);
ListView1.SetColorPullRefreshIndicator(TAlphaColorRec.Limegreen);
ListView1.SetColorStretchGlow(TAlphaColorRec.Limegreen);
end;
procedure TForm1.ListView1ButtonClick(const Sender: TObject; const AItem: TListItem;
const AObject: TListItemSimpleControl);
begin
if ListView1.IsCustomColorUsed(AItem.Index) then
ListView1.SetDefaultColorForItem(AItem.Index)
else
ListView1.SetCustomColorForItem(AItem.Index, TAlphaColorF.Create(random(255) / 255, random(255) / 255,
random(255) / 255, random(255) / 255).ToAlphaColor);
end;
procedure TForm1.ListView1UpdatingObjects(const Sender: TObject; const AItem: TListViewItem; var AHandled: Boolean);
begin
// TListViewTextButtonFix.Rendering(Sender, AItem, AHandled);
end;
procedure TForm1.Switch1Switch(Sender: TObject);
begin
ListView1.AlternatingColors := Switch1.IsChecked;
end;
end.