-
Notifications
You must be signed in to change notification settings - Fork 1
/
UnitFlagsUnit.pas
118 lines (105 loc) · 2.24 KB
/
UnitFlagsUnit.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
unit UnitFlagsUnit;
interface
uses
System.SysUtils,
System.Types,
System.UITypes,
System.Classes,
System.Variants,
System.IniFiles,
Data.DB,
FMX.Types,
FMX.Controls,
FMX.Forms,
FMX.Dialogs,
FMX.Objects,
FMX.Menus,
FMX.Grid,
FMX.ExtCtrls,
FMX.ListBox,
FMX.TreeView,
FMX.Memo,
FMX.TabControl,
FMX.Layouts,
FMX.Edit,
FMX.Platform,
FMX.Bind.DBEngExt,
FMX.Bind.Editors,
FMX.Bind.DBLinks,
FMX.Bind.Navigator,
Data.Bind.EngExt,
Data.Bind.Components,
Data.Bind.DBScope,
Data.Bind.DBLinks,
Datasnap.DBClient,
Fmx.Bind.Grid,
System.Rtti,
System.Bindings.Outputs,
Data.Bind.Grid,
Fmx.StdCtrls,
FMX.Header,
FMX.Graphics;
type
TUnitFlagsForm = class(TForm)
Bevel: TPanel;
btCancel: TButton;
btOK: TButton;
btCheckAll: TButton;
clbMain: TCheckListBox;
procedure FormCreate(Sender: TObject);
procedure btOKClick(Sender: TObject);
procedure btCheckAllClick(Sender: TObject);
private
FFlags: int64;
{ Private declarations }
public
{ Public declarations }
property Flags: int64 read FFlags;
procedure Prepare(Text: string);
procedure Load(What: string);
end;
implementation
uses MyDataModule, Functions;
{$R *.FMX}
{ TUnitFlagsForm }
procedure TUnitFlagsForm.btCheckAllClick(Sender: TObject);
var
i: integer;
begin
FFlags := StrToInt64Def(Text,0);
for i := 0 to clbMain.Items.Count - 1 do
begin
clbMain.Checked[i] := true;
end;
end;
procedure TUnitFlagsForm.btOKClick(Sender: TObject);
var
i: integer;
begin
FFlags := 0;
for i := 0 to clbMain.Items.Count - 1 do
if clbMain.Checked[i] then FFlags := FFlags or (1 shl i);
end;
procedure TUnitFlagsForm.FormCreate(Sender: TObject);
begin
dmMain.Translate.CreateDefaultTranslation(TForm(Self));
dmMain.Translate.TranslateForm(TForm(Self));
end;
procedure TUnitFlagsForm.Load(What: string);
begin
Caption := What;
LoadStringListFromFile(clbMain.Items, What);
if clbMain.Items.Count <= 16 then clbMain.Columns := 1;
end;
procedure TUnitFlagsForm.Prepare(Text: string);
var
i: integer;
begin
FFlags := StrToInt64Def(Text,0);
for i := 0 to clbMain.Items.Count - 1 do
begin
if FFlags and (1 shl i) <> 0 then
clbMain.Checked[i] := true;
end;
end;
end.