[Gambas-user] Positioning the editor to a specific line and making it visible

Benoît Minisini gambas at ...1...
Wed Jan 15 03:44:34 CET 2014


Le 15/01/2014 01:44, Bruce a écrit :
> I can't work out how to do this.
>
> I have an Editor control with a form definition (xyz.form) in it, I am
> trying to search for the definition of, say, a toolbar called
> "tbrProjectEdit" which starts at line 220.  This is initiated by a
> double click on a gridview on the "Toolbars" tab in the screenshot.
>
> Public Sub gvwToolbars_Activate()
>
>    Dim sKey As String = gvwToolbars[gvwToolbars.Row,
> gvwToolbars.Column].Text
>    Dim iLine As Integer
>
>    ...
>
>    If gvwToolbars.Column = 1 Then
>      iLine = edtFormDef.FindNextWord(skey, 0)      <-- 1
>      edtFormDef.Select(iLine, 0, iLine, 999)       <-- 2
>      edtFormDef.CurrentLine = iLine                <-- 3
>      ' edtFormDef.Lines[iline].Expanded = True
>      ' edtFormDef.Scroll(edtFormDef.ToPosX(0, iLine), 0)
>      edtFormDef.SetFocus
>      TabStrip1.Index = 0
>    Endif
>
> End
>
> 1) Finds the line fine.
> 2) Sets the selection fine.
> 3) and the next two lines are my attempts at making that line visible in
> the editor. To no avail.  It just remains at the top of the text.
> But, if I just adjust the size of the form a touch, the editor is
> redisplayed exactly where I want it, as in the 2nd screenshot.
>
> What am I missing?
>
> tia
> Bruce
>

The CurrentLine is for highlighting the current line of code during a 
debugging session.

Use the Editor.Goto() method instead.

Regards,

-- 
Benoît Minisini




More information about the User mailing list