[fpc-pascal] Anchors on a child form
Mattias Gaertner
nc-gaertnma at netcologne.de
Mon Jun 4 13:01:08 CEST 2018
On Sun, 3 Jun 2018 13:06:59 +0100
Martin Wynne <martin at templot.com> wrote:
> If I create a child form by setting Parent:=other_form; in FormCreate,
> it cannot be dragged to a new position by the user.
Correct. Setting aForm.Parent makes the form a "normal" control like a
frame or panel. If you want dragging, you need to do the same as for
any other LCL control:
http://wiki.freepascal.org/LCL_Drag_Drop
> 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:
Removing anchors won't give you dragging. It centers a control on its
parent client area.
> 'TWinControl.WMSize loop detected, the widgetset does not like the LCL
> bounds or sends unneeded wmsize messages'.
Can you create a bug report with an example to reproduce the loop?
> 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.
Can you give more details, what the Delphi program does?
Mattias
More information about the fpc-pascal
mailing list