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

Bart bartjunk64 at gmail.com
Sun Dec 11 13:14:44 CET 2011


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;

Bart




More information about the Lazarus mailing list