-
Notifications
You must be signed in to change notification settings - Fork 1
/
StyleBookDM.pas
61 lines (52 loc) · 1.28 KB
/
StyleBookDM.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
unit StyleBookDM;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs,
System.Generics.Collections, FMX.StdCtrls;
type
TdmStyleBooks = class(TForm)
sbAmakrits: TStyleBook;
sbAir: TStyleBook;
sbBlend: TStyleBook;
sbLight: TStyleBook;
sbAquaGraphite: TStyleBook;
sbGoldenGraphite: TStyleBook;
sbDark: TStyleBook;
sbRubyGraphite: TStyleBook;
sbTransparent: TStyleBook;
Label1: TLabel;
procedure FormCreate(Sender: TObject);
private
sbList: TObjectList<TStyleBook>;
idx: Integer;
function GetNextSB: TStyleBook;
{ Private declarations }
public
{ Public declarations }
property NextStyleBook: TStyleBook read GetNextSB;
end;
var
dmStyleBooks: TdmStyleBooks;
implementation
{$R *.fmx}
procedure TdmStyleBooks.FormCreate(Sender: TObject);
var
x: Integer;
begin
sbList := TObjectList<TStyleBook>.Create;
for x := 0 to Self.ComponentCount - 1 do
begin
if Self.Components[x] is TStyleBook then
sbList.Add(Self.Components[x] as TStyleBook);
end;
idx := 0;
end;
function TdmStyleBooks.GetNextSB: TStyleBook;
begin
inc(idx);
if idx >= sbList.Count then
idx := 0;
Result := sbList[idx];
end;
end.