[Lazarus] focus vs. parent changing

Mattias Gaertner nc-gaertnma at netcologne.de
Mon Jan 24 18:16:28 CET 2011


 
 

u-boot <myabos at t-online.de> hat am 24. Januar 2011 um 17:49 geschrieben:

> Same question here as in irc nobody answered it a few hours ago.
>
>
> I tried the following lines. It does not work with setfocus before
> parent changing.
> My question is, if it should work in this order or if this is correct
> behaviour.
>
>
> procedure TForm1.Button1Click(Sender: TObject);
> begin
>   edit1.SetFocus;
>   if (Edit1.Parent=Panel2) Then Edit1.Parent:=Panel1 else
> Edit1.Parent:=Panel2;
> end; 
Changing the Parent switches the focus to another control.
So, you should set the focus after changing the parent.
 
Mattias
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20110124/6f641bbf/attachment-0003.html>


More information about the Lazarus mailing list