diff options
Diffstat (limited to 'examples/apps')
-rw-r--r-- | examples/apps/ide/src/frm_main.pas | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas index 6d4e81b7..6dd31a31 100644 --- a/examples/apps/ide/src/frm_main.pas +++ b/examples/apps/ide/src/frm_main.pas @@ -76,6 +76,7 @@ type procedure miFindClicked(Sender: TObject); procedure miFindNextClicked(Sender: TObject); procedure miFindPrevClicked(Sender: TObject); + procedure miGoToLineClick(Sender: TObject); procedure miSearchProcedureList(Sender: TObject); procedure miAboutFPGuiClicked(Sender: TObject); procedure miAboutIDE(Sender: TObject); @@ -262,6 +263,27 @@ begin edt.SetFocus; end; +procedure TMainForm.miGoToLineClick(Sender: TObject); +var + sValue: string; + i: integer; + edt: TfpgTextEdit; +begin + edt := TfpgTextEdit(pcEditor.ActivePage.Components[0]); + if not Assigned(edt) then + Exit; + if fpgInputQuery('Go to line', 'Go to line number?', sValue) then + begin + try + i := StrToInt(sValue); + edt.GotoLine(i); + except + on E: Exception do + ShowMessage('Invalid line number.' + LineEnding + E.Message); + end; + end; +end; + procedure TMainForm.miSearchProcedureList(Sender: TObject); var s: TfpgString; @@ -1493,6 +1515,7 @@ begin AddMenuItem('Replace...', rsKeyCtrl+'R', nil).Enabled := False; AddMenuItem('-', '', nil); AddMenuItem('Procedure List...', rsKeyCtrl+'G', @miSearchProcedureList); + AddMenuItem('Go to line...', rsKeyAlt+'G', @miGoToLineClick); end; mnuView := TfpgPopupMenu.Create(self); |