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