| 1 | unit UFormValue;
|
|---|
| 2 |
|
|---|
| 3 | {$mode delphi}
|
|---|
| 4 |
|
|---|
| 5 | interface
|
|---|
| 6 |
|
|---|
| 7 | uses
|
|---|
| 8 | Classes, SysUtils, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls,
|
|---|
| 9 | Spin, UGeneralRegistry;
|
|---|
| 10 |
|
|---|
| 11 | type
|
|---|
| 12 |
|
|---|
| 13 | { TFormValue }
|
|---|
| 14 |
|
|---|
| 15 | TFormValue = class(TForm)
|
|---|
| 16 | ButtonOk: TButton;
|
|---|
| 17 | ButtonCancel: TButton;
|
|---|
| 18 | CheckBoxValue: TCheckBox;
|
|---|
| 19 | ComboBoxType: TComboBox;
|
|---|
| 20 | EditName: TEdit;
|
|---|
| 21 | EditValue: TEdit;
|
|---|
| 22 | Label1: TLabel;
|
|---|
| 23 | Label3: TLabel;
|
|---|
| 24 | Label4: TLabel;
|
|---|
| 25 | Label5: TLabel;
|
|---|
| 26 | Label6: TLabel;
|
|---|
| 27 | PageControl1: TPageControl;
|
|---|
| 28 | SpinEditValue: TSpinEdit;
|
|---|
| 29 | TabSheetBoolean: TTabSheet;
|
|---|
| 30 | TabSheetString: TTabSheet;
|
|---|
| 31 | TabSheetInteger: TTabSheet;
|
|---|
| 32 | procedure ComboBoxTypeSelect(Sender: TObject);
|
|---|
| 33 | procedure FormCreate(Sender: TObject);
|
|---|
| 34 | procedure FormShow(Sender: TObject);
|
|---|
| 35 | private
|
|---|
| 36 |
|
|---|
| 37 | public
|
|---|
| 38 | function GetValueType: TRegValueType;
|
|---|
| 39 | procedure SetValueType(ValueType: TRegValueType);
|
|---|
| 40 | end;
|
|---|
| 41 |
|
|---|
| 42 | var
|
|---|
| 43 | FormValue: TFormValue;
|
|---|
| 44 |
|
|---|
| 45 |
|
|---|
| 46 | implementation
|
|---|
| 47 |
|
|---|
| 48 | {$R *.lfm}
|
|---|
| 49 |
|
|---|
| 50 |
|
|---|
| 51 | { TFormValue }
|
|---|
| 52 |
|
|---|
| 53 | procedure TFormValue.FormShow(Sender: TObject);
|
|---|
| 54 | begin
|
|---|
| 55 | end;
|
|---|
| 56 |
|
|---|
| 57 | function TFormValue.GetValueType: TRegValueType;
|
|---|
| 58 | begin
|
|---|
| 59 | Result := TRegValueType(ComboBoxType.ItemIndex + 1);
|
|---|
| 60 | end;
|
|---|
| 61 |
|
|---|
| 62 | procedure TFormValue.SetValueType(ValueType: TRegValueType);
|
|---|
| 63 | begin
|
|---|
| 64 | ComboBoxType.ItemIndex := Integer(ValueType) - 1;
|
|---|
| 65 | ComboBoxTypeSelect(nil);
|
|---|
| 66 | end;
|
|---|
| 67 |
|
|---|
| 68 | procedure TFormValue.ComboBoxTypeSelect(Sender: TObject);
|
|---|
| 69 | begin
|
|---|
| 70 | if GetValueType = vtString then TabSheetString.Show
|
|---|
| 71 | else if GetValueType = vtInteger then TabSheetInteger.Show
|
|---|
| 72 | else if GetValueType = vtBoolean then TabSheetBoolean.Show;
|
|---|
| 73 | end;
|
|---|
| 74 |
|
|---|
| 75 | procedure TFormValue.FormCreate(Sender: TObject);
|
|---|
| 76 | var
|
|---|
| 77 | I: TRegValueType;
|
|---|
| 78 | begin
|
|---|
| 79 | ComboBoxType.Items.BeginUpdate;
|
|---|
| 80 | ComboBoxType.Items.Clear;
|
|---|
| 81 | for I := Succ(Low(TRegValueType)) to High(TRegValueType) do
|
|---|
| 82 | ComboBoxType.Items.Add(RegValueTypeName[I]);
|
|---|
| 83 | ComboBoxType.Items.EndUpdate;
|
|---|
| 84 | if (ComboBoxType.ItemIndex = -1) and (ComboBoxType.Items.Count > 0) then
|
|---|
| 85 | ComboBoxType.ItemIndex := 0;
|
|---|
| 86 | end;
|
|---|
| 87 |
|
|---|
| 88 | end.
|
|---|
| 89 |
|
|---|