mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-16 18:08:18 +02:00
IDE: GotoLine dialog:
- restrict user input - disable OK button if text is not a number git-svn-id: trunk@60108 -
This commit is contained in:
parent
c3186f7af3
commit
df0b4e4aa9
@ -9,7 +9,7 @@ object frmGoto: TfrmGoto
|
|||||||
Caption = 'frmGoto'
|
Caption = 'frmGoto'
|
||||||
ClientHeight = 101
|
ClientHeight = 101
|
||||||
ClientWidth = 250
|
ClientWidth = 250
|
||||||
LCLVersion = '0.9.29'
|
LCLVersion = '2.1.0.0'
|
||||||
object Label1: TLabel
|
object Label1: TLabel
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 14
|
Height = 14
|
||||||
@ -28,6 +28,8 @@ object frmGoto: TfrmGoto
|
|||||||
Align = alTop
|
Align = alTop
|
||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
Constraints.MinWidth = 200
|
Constraints.MinWidth = 200
|
||||||
|
OnChange = Edit1Change
|
||||||
|
OnKeyPress = Edit1KeyPress
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
Text = 'Edit1'
|
Text = 'Edit1'
|
||||||
end
|
end
|
||||||
@ -38,11 +40,15 @@ object frmGoto: TfrmGoto
|
|||||||
Width = 238
|
Width = 238
|
||||||
Align = alTop
|
Align = alTop
|
||||||
OKButton.Name = 'OKButton'
|
OKButton.Name = 'OKButton'
|
||||||
|
OKButton.DefaultCaption = True
|
||||||
HelpButton.Name = 'HelpButton'
|
HelpButton.Name = 'HelpButton'
|
||||||
|
HelpButton.DefaultCaption = True
|
||||||
HelpButton.Enabled = False
|
HelpButton.Enabled = False
|
||||||
CloseButton.Name = 'CloseButton'
|
CloseButton.Name = 'CloseButton'
|
||||||
|
CloseButton.DefaultCaption = True
|
||||||
CloseButton.Enabled = False
|
CloseButton.Enabled = False
|
||||||
CancelButton.Name = 'CancelButton'
|
CancelButton.Name = 'CancelButton'
|
||||||
|
CancelButton.DefaultCaption = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
ShowButtons = [pbOK, pbCancel]
|
ShowButtons = [pbOK, pbCancel]
|
||||||
ShowBevel = False
|
ShowBevel = False
|
||||||
|
@ -36,6 +36,8 @@ type
|
|||||||
ButtonPanel1: TButtonPanel;
|
ButtonPanel1: TButtonPanel;
|
||||||
Label1: TLabel;
|
Label1: TLabel;
|
||||||
Edit1: TEdit;
|
Edit1: TEdit;
|
||||||
|
procedure Edit1Change(Sender: TObject);
|
||||||
|
procedure Edit1KeyPress(Sender: TObject; var Key: char);
|
||||||
public
|
public
|
||||||
constructor Create(AOwner: TComponent); override;
|
constructor Create(AOwner: TComponent); override;
|
||||||
procedure DoShow; override;
|
procedure DoShow; override;
|
||||||
@ -47,6 +49,19 @@ implementation
|
|||||||
|
|
||||||
{ TfrmGoto }
|
{ TfrmGoto }
|
||||||
|
|
||||||
|
procedure TfrmGoto.Edit1KeyPress(Sender: TObject; var Key: char);
|
||||||
|
begin
|
||||||
|
if not (UpCase(Key) in [#8,'0'..'9']) then
|
||||||
|
Key:=#0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TfrmGoto.Edit1Change(Sender: TObject);
|
||||||
|
var
|
||||||
|
L: Integer;
|
||||||
|
begin
|
||||||
|
ButtonPanel1.OKButton.Enabled := TryStrToInt(Edit1.Text,L);
|
||||||
|
end;
|
||||||
|
|
||||||
constructor TfrmGoto.Create(AOwner: TComponent);
|
constructor TfrmGoto.Create(AOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited Create(AOwner);
|
inherited Create(AOwner);
|
||||||
@ -56,12 +71,14 @@ begin
|
|||||||
ButtonPanel1.OKButton.Caption:=lisMenuOk;
|
ButtonPanel1.OKButton.Caption:=lisMenuOk;
|
||||||
ButtonPanel1.CancelButton.Caption:=lisCancel;
|
ButtonPanel1.CancelButton.Caption:=lisCancel;
|
||||||
Edit1.Caption := '';
|
Edit1.Caption := '';
|
||||||
|
Edit1.MaxLength := 10; //enough for MaxLongInt
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TfrmGoto.DoShow;
|
procedure TfrmGoto.DoShow;
|
||||||
begin
|
begin
|
||||||
Edit1.SelectAll;
|
Edit1.SelectAll;
|
||||||
Edit1.SetFocus;
|
Edit1.SetFocus;
|
||||||
|
Edit1Change(nil);
|
||||||
inherited DoShow;
|
inherited DoShow;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user