[Lazarus] How to set focus in an Edit in multiple TabSheet?

silvioprog silvioprog at gmail.com
Sun Dec 11 18:49:52 CET 2011


2011/12/11 Bart <bartjunk64 at gmail.com>:
> On 12/10/11, silvioprog <silvioprog at gmail.com> wrote:
>
> I remeber using SomeContrl.SetFocus in the OnChange of TPageControl
> (actually I did an override on DoChange) and this works for me (on
> Windows, not tested yet on other widgetsets).
>
> Here's a snippet of the relevant code.
>
> procedure TEditorPageControl.DoChange;
> var
>  Ed: TEditor;
> begin
>  inherited DoChange;
>  Ed := GetCurrentEditor;
>  InternalEditorStatusChange(Ed,
> [scCaretX,scCaretY,scModified,scInsertMode,scFileName]);
>  if Assigned(Ed) then
>  begin
>    try
>      Ed.SetFocus;
>    except;
>      debugln('TEditorPageControl.DoChange: could not set focus to
> current editor');
>    end;
>  end;
> end;

I tried to run this code, but I have not found the function GetCurrentEditor.

This code works with a PageControl over another PageControl?

-- 
Silvio Clécio
===============================================
Blog - <silvioprog.com.br>
Twitter - <twitter.com/silvioprog>
Facebook - <facebook.com/silvioprog>
LazSolutions - <code.google.com/p/lazsolutions>
Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR>
===============================================
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===============================================




More information about the Lazarus mailing list