diff --git a/ide/gotofrm.lfm b/ide/gotofrm.lfm index 8b2eade799..986146a103 100644 --- a/ide/gotofrm.lfm +++ b/ide/gotofrm.lfm @@ -9,7 +9,7 @@ object frmGoto: TfrmGoto Caption = 'frmGoto' ClientHeight = 101 ClientWidth = 250 - LCLVersion = '0.9.29' + LCLVersion = '2.1.0.0' object Label1: TLabel Left = 6 Height = 14 @@ -28,6 +28,8 @@ object frmGoto: TfrmGoto Align = alTop BorderSpacing.Around = 6 Constraints.MinWidth = 200 + OnChange = Edit1Change + OnKeyPress = Edit1KeyPress TabOrder = 0 Text = 'Edit1' end @@ -38,11 +40,15 @@ object frmGoto: TfrmGoto Width = 238 Align = alTop OKButton.Name = 'OKButton' + OKButton.DefaultCaption = True HelpButton.Name = 'HelpButton' + HelpButton.DefaultCaption = True HelpButton.Enabled = False CloseButton.Name = 'CloseButton' + CloseButton.DefaultCaption = True CloseButton.Enabled = False CancelButton.Name = 'CancelButton' + CancelButton.DefaultCaption = True TabOrder = 1 ShowButtons = [pbOK, pbCancel] ShowBevel = False diff --git a/ide/gotofrm.pas b/ide/gotofrm.pas index c0164745d1..7b8cb31034 100644 --- a/ide/gotofrm.pas +++ b/ide/gotofrm.pas @@ -36,6 +36,8 @@ type ButtonPanel1: TButtonPanel; Label1: TLabel; Edit1: TEdit; + procedure Edit1Change(Sender: TObject); + procedure Edit1KeyPress(Sender: TObject; var Key: char); public constructor Create(AOwner: TComponent); override; procedure DoShow; override; @@ -47,6 +49,19 @@ implementation { 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); begin inherited Create(AOwner); @@ -56,12 +71,14 @@ begin ButtonPanel1.OKButton.Caption:=lisMenuOk; ButtonPanel1.CancelButton.Caption:=lisCancel; Edit1.Caption := ''; + Edit1.MaxLength := 10; //enough for MaxLongInt end; procedure TfrmGoto.DoShow; begin Edit1.SelectAll; Edit1.SetFocus; + Edit1Change(nil); inherited DoShow; end;