Finalize version.
[marekmrva_bc.git] / TagEditClass.pas
blobd3e3cff4e8f056e1626db4d1ed52d3d4ddbee6e7
1 unit TagEditClass;
3 interface
5 uses
6 ConstantsClass, ResourcesClass,
7 Classes, Controls, Forms, StdCtrls;
9 type
11 { TTagEdit }
13 TTagEdit = class(TForm)
14 private
15 pButtons: array [0..3] of TRadioButton;
16 pChange, pCancel: TButton;
17 public
18 constructor Create(AOwner: TComponent); override;
19 function ShowBox(var Input: Integer): Boolean; virtual;
20 end;
22 implementation
24 // ************************************************************************** //
25 // * TTagEdit implementation * //
26 // ************************************************************************** //
28 constructor TTagEdit.Create(AOwner: TComponent);
29 var
30 i: Integer;
31 begin
32 inherited CreateNew(AOwner, 0);
33 Position := poDesktopCenter;
34 ClientWidth := 181;
35 ClientHeight := 95;
36 BorderStyle := bsDialog;
37 pChange := TButton.Create(Self);
38 with pChange do
39 begin
40 Parent := Self;
41 Caption := FL_EDIT_OK;
42 Left := 17;
43 Top := 66;
44 Width := 72;
45 Height := 20;
46 ModalResult := mrOk;
47 Default := True;
48 end;
49 pCancel := TButton.Create(Self);
50 with pCancel do
51 begin
52 Parent := Self;
53 Caption := FL_EDIT_CANCEL;
54 Left := 93;
55 Top := 66;
56 Width := 72;
57 Height := 20;
58 ModalResult := mrCancel;
59 Cancel := True;
60 end;
61 for i := 0 to 1 do
62 begin
63 pButtons[i] := TRadioButton.Create(Self);
64 with pButtons[i] do
65 begin
66 Parent := Self;
67 Caption := DESC_TAG[i];
68 Left := 9;
69 Top := (23 * i) + 7;
70 Width := 80;
71 Height := 19;
72 end;
73 end;
74 for i := 2 to 3 do
75 begin
76 pButtons[i] := TRadioButton.Create(Self);
77 with pButtons[i] do
78 begin
79 Parent := Self;
80 Caption := DESC_TAG[i];
81 Left := 99;
82 Top := (23 * (i - 2)) + 7;
83 Width := 80;
84 Height := 19;
85 end;
86 end;
87 end;
89 function TTagEdit.ShowBox(var Input: Integer): Boolean;
90 var
91 i: Integer;
92 begin
93 Result := False;
94 if (Input < 0) or not(Input < Length(pButtons)) then Exit;
95 pButtons[Input].Checked := True;
96 if (Self.ShowModal = mrOk) then
97 begin
98 for i := 0 to (Length(pButtons) - 1) do
99 if pButtons[i].Checked then
100 begin
101 Input := i;
102 Break;
103 end;
104 Result := True;
105 end;
106 end;
108 end.