[fpc-pascal] Anchors on a child form

Martin Wynne martin at templot.com
Sun Jun 3 14:06:59 CEST 2018


If I create a child form by setting Parent:=other_form; in FormCreate, 
it cannot be dragged to a new position by the user.

If I then remove the top and left anchors by setting Anchors:=[]; in 
FormCreate (or in the Object Inspector) so that it can be dragged, I get 
this exception:

'TWinControl.WMSize loop detected, the widgetset does not like the LCL 
bounds or sends unneeded wmsize messages'.

I have tried setting

Windows.SetParent(Handle,other_form.Handle); (instead of 
Parent:=other_form;)

which removes the exception, but the child form then retains focus after 
use, preventing the parent form from responding to the keyboard (which 
defeats the object of using a child form in the first place).

I'm porting a project to Lazarus from Delphi5, where it works fine. 
Child forms can be dragged around even with the top and left anchors set.

Thanks for any help in fixing this.

Martin.



More information about the fpc-pascal mailing list