1 |
torben |
2671 |
(* ***** BEGIN LICENSE BLOCK *****
|
2 |
|
|
* Version: MPL 1.1
|
3 |
|
|
*
|
4 |
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
5 |
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
6 |
|
|
* the License. You may obtain a copy of the License at
|
7 |
|
|
* http://www.mozilla.org/MPL/
|
8 |
|
|
*
|
9 |
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
10 |
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
11 |
|
|
* for the specific language governing rights and limitations under the
|
12 |
|
|
* License.
|
13 |
|
|
*
|
14 |
|
|
* The Original Code is TurboPower SysTools
|
15 |
|
|
*
|
16 |
|
|
* The Initial Developer of the Original Code is
|
17 |
|
|
* TurboPower Software
|
18 |
|
|
*
|
19 |
|
|
* Portions created by the Initial Developer are Copyright (C) 1996-2002
|
20 |
|
|
* the Initial Developer. All Rights Reserved.
|
21 |
|
|
*
|
22 |
|
|
* Contributor(s):
|
23 |
|
|
*
|
24 |
|
|
* ***** END LICENSE BLOCK ***** *)
|
25 |
|
|
|
26 |
|
|
unit RIEditU2;
|
27 |
|
|
|
28 |
|
|
interface
|
29 |
|
|
|
30 |
|
|
uses
|
31 |
|
|
Windows, Messages, Classes, Graphics, Forms, Controls, Buttons,
|
32 |
|
|
StdCtrls, ExtCtrls, Mask;
|
33 |
|
|
|
34 |
|
|
type
|
35 |
|
|
EditingStateType = (etAll, etName, etValue);
|
36 |
|
|
|
37 |
|
|
TDataDlg = class(TForm)
|
38 |
|
|
OKBtn: TBitBtn;
|
39 |
|
|
CancelBtn: TBitBtn;
|
40 |
|
|
DataTypeRG: TRadioGroup;
|
41 |
|
|
Label1: TLabel;
|
42 |
|
|
ValueName: TEdit;
|
43 |
|
|
Label2: TLabel;
|
44 |
|
|
IData: TMaskEdit;
|
45 |
|
|
procedure DataTypeRGClick(Sender: TObject);
|
46 |
|
|
procedure FormActivate(Sender: TObject);
|
47 |
|
|
private
|
48 |
|
|
{ Private declarations }
|
49 |
|
|
public
|
50 |
|
|
{ Public declarations }
|
51 |
|
|
EditingState : EditingStateType;
|
52 |
|
|
RGIdx : Integer;
|
53 |
|
|
end;
|
54 |
|
|
|
55 |
|
|
var
|
56 |
|
|
DataDlg: TDataDlg;
|
57 |
|
|
|
58 |
|
|
implementation
|
59 |
|
|
|
60 |
|
|
{$R *.DFM}
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
procedure TDataDlg.DataTypeRGClick(Sender: TObject);
|
64 |
|
|
begin
|
65 |
|
|
case DataTypeRG.ItemIndex of
|
66 |
|
|
0,
|
67 |
|
|
1,
|
68 |
|
|
5 : begin
|
69 |
|
|
IData.MaxLength := 256;
|
70 |
|
|
IData.EditMask := '';
|
71 |
|
|
end;
|
72 |
|
|
2,
|
73 |
|
|
3 : begin
|
74 |
|
|
IData.MaxLength := 10;
|
75 |
|
|
IData.EditMask := '';
|
76 |
|
|
end;
|
77 |
|
|
4 : begin
|
78 |
|
|
IData.MaxLength := 15;
|
79 |
|
|
IData.EditMask := '';
|
80 |
|
|
end;
|
81 |
|
|
6 : begin
|
82 |
|
|
IData.MaxLength := 12;
|
83 |
|
|
IData.EditMask := '';
|
84 |
|
|
end;
|
85 |
|
|
end;
|
86 |
|
|
IData.SetFocus;
|
87 |
|
|
end;
|
88 |
|
|
|
89 |
|
|
procedure TDataDlg.FormActivate(Sender: TObject);
|
90 |
|
|
begin
|
91 |
|
|
DataTypeRG.ItemIndex := RGIdx;
|
92 |
|
|
case EditingState of
|
93 |
|
|
etAll : begin
|
94 |
|
|
DataTypeRG.Enabled := True;
|
95 |
|
|
IData.Enabled := True;
|
96 |
|
|
ValueName.Enabled := True;
|
97 |
|
|
DataTypeRG.ItemIndex := 5;
|
98 |
|
|
ValueName.SetFocus;
|
99 |
|
|
end;
|
100 |
|
|
|
101 |
|
|
etName : begin
|
102 |
|
|
DataTypeRG.Enabled := False;
|
103 |
|
|
ValueName.Enabled := True;
|
104 |
|
|
IData.Enabled := False;
|
105 |
|
|
DataTypeRG.ItemIndex := RGIdx;
|
106 |
|
|
ValueName.SetFocus;
|
107 |
|
|
end;
|
108 |
|
|
|
109 |
|
|
etValue : begin
|
110 |
|
|
DataTypeRG.Enabled := False;
|
111 |
|
|
ValueName.Enabled := False;
|
112 |
|
|
IData.Enabled := True;
|
113 |
|
|
DataTypeRG.ItemIndex := RGIdx;
|
114 |
|
|
IData.SetFocus;
|
115 |
|
|
end;
|
116 |
|
|
end;
|
117 |
|
|
end;
|
118 |
|
|
|
119 |
|
|
end.
|