Re: [lazarus] CodeTools - jump to method I loose focus
On Mon, 27 Feb 2006 11:36:39 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Hi, I created a Lazarus addon which shows a list of procedures in a Modal dialog (same a GExperts Procedure List). Everythings seems to work fine, except for the editor focus after the jump. When I call the method below, it jumps to the correct location, and the Modal dialog closes, but now I cannot see my cursor in the editor? The editor looks like it has focus, but no cursor movement is shown when I press the up/down keys or even the Ctrl+up/down keys. Any ideas how I can resolve this? If you need the full source, I can email it directly. Some notes on the code below: LV = TListView component in Report style lItem.SubItems[3] holds the TCodeTreeNode.PosStart integer value procedure TProcedureListForm.JumpToSelection; var lItem: TListItem; Caret: TCodeXYPosition; NewTopLine: integer; CodeBuffer: TCodeBuffer; ACodeTool: TCodeTool; lStartPos: integer; begin lItem := LV.Selected; if lItem = nil then Exit; //== if lItem.SubItems[3] = '' then Exit; //== lStartPos := StrToInt(lItem.SubItems[3]); CodeBuffer := CodeToolBoss.FindFile(MainFilename); if CodeBuffer = nil then Exit; //== ACodeTool := nil; CodeToolBoss.Explore(CodeBuffer,ACodeTool,false); if ACodeTool = nil then Exit; //== if not ACodeTool.CleanPosToCaretAndTopLine(lStartPos, Caret, NewTopLine) then Exit; //== LazarusIDE.DoOpenFileAndJumpToPos(Caret.Code.Filename, Point(Caret.X, Caret.Y), NewTopLine, -1, [ofRegularFile,ofUseCache]); The form is still modal, so the source editor can not be focused. Move the above line behind the ShowModal. Save the needed values in some public properties. Close; end; { method the launches the dialog } procedure ExecuteProcedureList(Sender: TObject); begin with TProcedureListForm.Create(Application) do try ShowModal; Add here: if ShowModal=mrOk then LazarusIDE.DoOpenFileAndJumpToPos ... finally Free; end; end; Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] CodeTools - jump to method I loose focus
Thanks Mattias. Thinking about it now, the problem makes sense. Made the change and it works perfectly now! I am very impressed with CodeTools so far! I have only scratched the surface of what it can do, but it is brilliant. Once you get the basics of how it works and what each class does, it becomes much easier. I took me much longer to write this addon for Kylix, than for Lazarus, thanks to CodeTools, which did most of the work for me. Regards, - Graeme - On 2/27/06, Mattias Gaertner [EMAIL PROTECTED] wrote: On Mon, 27 Feb 2006 11:36:39 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Hi, I created a Lazarus addon which shows a list of procedures in a Modal dialog (same a GExperts Procedure List). Everythings seems to work fine, except for the editor focus after the jump. When I call the method below, it jumps to the correct location, and the Modal dialog closes, but now I cannot see my cursor in the editor? The editor looks like it has focus, but no cursor movement is shown when I press the up/down keys or even the Ctrl+up/down keys. Any ideas how I can resolve this? If you need the full source, I can email it directly. Some notes on the code below: LV = TListView component in Report style lItem.SubItems[3] holds the TCodeTreeNode.PosStart integer value procedure TProcedureListForm.JumpToSelection; var lItem: TListItem; Caret: TCodeXYPosition; NewTopLine: integer; CodeBuffer: TCodeBuffer; ACodeTool: TCodeTool; lStartPos: integer; begin lItem := LV.Selected; if lItem = nil then Exit; //== if lItem.SubItems[3] = '' then Exit; //== lStartPos := StrToInt(lItem.SubItems[3]); CodeBuffer := CodeToolBoss.FindFile(MainFilename); if CodeBuffer = nil then Exit; //== ACodeTool := nil; CodeToolBoss.Explore(CodeBuffer,ACodeTool,false); if ACodeTool = nil then Exit; //== if not ACodeTool.CleanPosToCaretAndTopLine(lStartPos, Caret, NewTopLine) then Exit; //== LazarusIDE.DoOpenFileAndJumpToPos(Caret.Code.Filename, Point(Caret.X, Caret.Y), NewTopLine, -1, [ofRegularFile,ofUseCache]); The form is still modal, so the source editor can not be focused. Move the above line behind the ShowModal. Save the needed values in some public properties. Close; end; { method the launches the dialog } procedure ExecuteProcedureList(Sender: TObject); begin with TProcedureListForm.Create(Application) do try ShowModal; Add here: if ShowModal=mrOk then LazarusIDE.DoOpenFileAndJumpToPos ... finally Free; end; end; Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] CodeTools - jump to method I loose focus
On Mon, 27 Feb 2006 14:49:18 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Thanks Mattias. Thinking about it now, the problem makes sense. Made the change and it works perfectly now! I am very impressed with CodeTools so far! I have only scratched the surface of what it can do, but it is brilliant. Once you get the basics of how it works and what each class does, it becomes much easier. I took me much longer to write this addon for Kylix, than for Lazarus, thanks to CodeTools, which did most of the work for me. Thanks. Where is the addon available? Mattias Regards, - Graeme - On 2/27/06, Mattias Gaertner [EMAIL PROTECTED] wrote: On Mon, 27 Feb 2006 11:36:39 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Hi, I created a Lazarus addon which shows a list of procedures in a Modal dialog (same a GExperts Procedure List). Everythings seems to work fine, except for the editor focus after the jump. When I call the method below, it jumps to the correct location, and the Modal dialog closes, but now I cannot see my cursor in the editor? The editor looks like it has focus, but no cursor movement is shown when I press the up/down keys or even the Ctrl+up/down keys. Any ideas how I can resolve this? If you need the full source, I can email it directly. Some notes on the code below: LV = TListView component in Report style lItem.SubItems[3] holds the TCodeTreeNode.PosStart integer value procedure TProcedureListForm.JumpToSelection; var lItem: TListItem; Caret: TCodeXYPosition; NewTopLine: integer; CodeBuffer: TCodeBuffer; ACodeTool: TCodeTool; lStartPos: integer; begin lItem := LV.Selected; if lItem = nil then Exit; //== if lItem.SubItems[3] = '' then Exit; //== lStartPos := StrToInt(lItem.SubItems[3]); CodeBuffer := CodeToolBoss.FindFile(MainFilename); if CodeBuffer = nil then Exit; //== ACodeTool := nil; CodeToolBoss.Explore(CodeBuffer,ACodeTool,false); if ACodeTool = nil then Exit; //== if not ACodeTool.CleanPosToCaretAndTopLine(lStartPos, Caret, NewTopLine) then Exit; //== LazarusIDE.DoOpenFileAndJumpToPos(Caret.Code.Filename, Point(Caret.X, Caret.Y), NewTopLine, -1, [ofRegularFile,ofUseCache]); The form is still modal, so the source editor can not be focused. Move the above line behind the ShowModal. Save the needed values in some public properties. Close; end; { method the launches the dialog } procedure ExecuteProcedureList(Sender: TObject); begin with TProcedureListForm.Create(Application) do try ShowModal; Add here: if ShowModal=mrOk then LazarusIDE.DoOpenFileAndJumpToPos ... finally Free; end; end; Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] CodeTools - jump to method I loose focus
I will place it on my server tonight and post the link here... After a bit of public testing, and it being useful enough, maybe someone could add it to the Lazarus\Components folder. I am in the process on converting a few of the GExperts addons to Lazarus. This one is the first and a few more will follow over the next few days (time permitting). There are certain tool you just can't live without. ;-) Regards, - Graeme - On 2/27/06, Mattias Gaertner [EMAIL PROTECTED] wrote: On Mon, 27 Feb 2006 14:49:18 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Thanks Mattias. Thinking about it now, the problem makes sense. Made the change and it works perfectly now! I am very impressed with CodeTools so far! I have only scratched the surface of what it can do, but it is brilliant. Once you get the basics of how it works and what each class does, it becomes much easier. I took me much longer to write this addon for Kylix, than for Lazarus, thanks to CodeTools, which did most of the work for me. Thanks. Where is the addon available? Mattias Regards, - Graeme - On 2/27/06, Mattias Gaertner [EMAIL PROTECTED] wrote: On Mon, 27 Feb 2006 11:36:39 +0200 Graeme Geldenhuys [EMAIL PROTECTED] wrote: Hi, I created a Lazarus addon which shows a list of procedures in a Modal dialog (same a GExperts Procedure List). Everythings seems to work fine, except for the editor focus after the jump. When I call the method below, it jumps to the correct location, and the Modal dialog closes, but now I cannot see my cursor in the editor? The editor looks like it has focus, but no cursor movement is shown when I press the up/down keys or even the Ctrl+up/down keys. Any ideas how I can resolve this? If you need the full source, I can email it directly. Some notes on the code below: LV = TListView component in Report style lItem.SubItems[3] holds the TCodeTreeNode.PosStart integer value procedure TProcedureListForm.JumpToSelection; var lItem: TListItem; Caret: TCodeXYPosition; NewTopLine: integer; CodeBuffer: TCodeBuffer; ACodeTool: TCodeTool; lStartPos: integer; begin lItem := LV.Selected; if lItem = nil then Exit; //== if lItem.SubItems[3] = '' then Exit; //== lStartPos := StrToInt(lItem.SubItems[3]); CodeBuffer := CodeToolBoss.FindFile(MainFilename); if CodeBuffer = nil then Exit; //== ACodeTool := nil; CodeToolBoss.Explore(CodeBuffer,ACodeTool,false); if ACodeTool = nil then Exit; //== if not ACodeTool.CleanPosToCaretAndTopLine(lStartPos, Caret, NewTopLine) then Exit; //== LazarusIDE.DoOpenFileAndJumpToPos(Caret.Code.Filename, Point(Caret.X, Caret.Y), NewTopLine, -1, [ofRegularFile,ofUseCache]); The form is still modal, so the source editor can not be focused. Move the above line behind the ShowModal. Save the needed values in some public properties. Close; end; { method the launches the dialog } procedure ExecuteProcedureList(Sender: TObject); begin with TProcedureListForm.Create(Application) do try ShowModal; Add here: if ShowModal=mrOk then LazarusIDE.DoOpenFileAndJumpToPos ... finally Free; end; end; Mattias _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives
Re: [lazarus] CodeTools - jump to method I loose focus
On Mon, 27 Feb 2006, Graeme Geldenhuys wrote: I will place it on my server tonight and post the link here... After a bit of public testing, and it being useful enough, maybe someone could add it to the Lazarus\Components folder. I am in the process on converting a few of the GExperts addons to Lazarus. This one is the first and a few more will follow over the next few days (time permitting). There are certain tool you just can't live without. ;-) I'll be the first to use them. GExperts is just too good :-) Michael. _ To unsubscribe: mail [EMAIL PROTECTED] with unsubscribe as the Subject archives at http://www.lazarus.freepascal.org/mailarchives