-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathExtendedDialogForm.pas
56 lines (46 loc) · 1.15 KB
/
ExtendedDialogForm.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
unit ExtendedDialogForm;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
DialogForm, StdCtrls, Buttons, unCalckConstants;
type
TfInputExtendedDialog = class(TfDialog)
eValue: TEdit;
procedure eValueExit(Sender: TObject);
procedure eValueKeyPress(Sender: TObject; var Key: Char);
private
{ Private declarations }
protected
function GetSectionName: string; override;
public
{ Public declarations }
end;
var
fInputExtendedDialog: TfInputExtendedDialog;
implementation
{$R *.DFM}
procedure TfInputExtendedDialog.eValueExit(Sender: TObject);
begin
inherited;
try
StrToFloat(eValue.Text);
except on Exception do begin
eValue.SetFocus;
MessageDlg(STR_3, mtError, [mbOk], 0);
Abort;
end;
end;
end;
procedure TfInputExtendedDialog.eValueKeyPress(Sender: TObject;
var Key: Char);
begin
inherited;
if not ((Key >= '0') and (Key <= '9')) then
if not((Key = FormatSettings.DecimalSeparator) or (Key = #8)) then
Key:=#0;
end;
function TfInputExtendedDialog.GetSectionName: string;
begin
Result:='fDialog';
end;
end.