Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2011-10

TWinControl.AddControl?

3 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Hans-Peter Diettrich

What's the purpose and action of TWinControl.AddControl?

The source code comment suggests
Add Handle object to *parents* Handle object.
but the code invokes

   TWSControlClass(WidgetSetClass).AddControl(Self);

with no Parent involved!

Can somebody explain that?

DoDi

Reply by email

Paul Ishenin
to Hans-Peter Diettrich
Hans-Peter Diettrich wrote 9 lines
What's the purpose and action of TWinControl.AddControl? The source code comment suggests Add Handle object to *parents* Handle object. but the code invokes TWSControlClass(WidgetSetClass).AddControl(Self); with no Parent involved! Can somebody explain that?

Well, Parent and Parent Handle are different. Parent is about LCL/VCL TControl property and Parent Handle is about widgetset window object like a call to SetParent(hWndChild, hWndParent: HWND): HWND.

Best regards,
Paul Ishenin

Reply by email

Hans-Peter Diettrich
to Paul Ishenin
Show quoted text 14 lines
21.10.2011 5:39, Hans-Peter Diettrich wrote: > What's the purpose and action of TWinControl.AddControl? > > The source code comment suggests > Add Handle object to *parents* Handle object. > but the code invokes > TWSControlClass(WidgetSetClass).AddControl(Self); > with no Parent involved! > > Can somebody explain that? Well, Parent and Parent Handle are different. Parent is about LCL/VCL TControl property and Parent Handle is about widgetset window object like a call to SetParent(hWndChild, hWndParent: HWND): HWND.

Right, but what's the purpose of AddControl, then?

Does it tell the widget to associate itself with the given control? Or does the widgetset obtain the associated widget from the LCL control.Handle, and then does what?

We also can postpone this question, until the widgetset interface is documented. For now it may be sufficient to document AddControl as "Call this method when <what reason or purpose?>".

DoDi

Reply by email