[lazarus] CreateComponent

Samuel Liddicott sam at campbellsci.co.uk
Fri Aug 20 10:42:22 EDT 1999




> -----Original Message-----
> From: Jeff Wormsley [mailto:daworm at cdc.net]
> Sent: 17 August 1999 01:31 PM
> To: lazarus at miraclec.com
> Subject: RE: RE: [lazarus] CreateComponent
>
> >> We do
> >> need to work out a clear method of handling the window handle,
> >> owner and parent for this.  What I have done so far has been to
> >> put the window handle in FComponent, and store self in the HWnd
> >> structure with SetProp.
> >
> >Oh.  Good.  I wasn't sure if GTK allowed setprop.
>
> Not in GTK, but straight Win32.  Everything in GTK is done
> through FComponent, which isn't a HWnd, but a pointer to the widget, IIRC.

I think HWnd needs to be the same as FComponent.

> >Do you use FindControl to get this LCL object?  I don't know how
> to do this
> >getprop stuff (GTK is totally new to me, winapi is not) - could
> you write a
> >function called FindControl(Hwnd) whch returns a TWinControl or
> nil for me
> >please?
>
> I'm talking win32, not GTK.  Check the list for my post with the
> Win32 stuff, then we'll be on the same page.  I need your help
> with this, as you seem to have a lot more experience with it.

OK.  FindControl on win32 does a getprop to get the delphi-control that
created a hwnd.

> >I think the callback function ought to lookup the hwnd (as it
> can) and then
> >call the wndproc as if it were a WM message.  This is neccessary
> for other
> >reasons I gave in another post whose subject escapes me right now.
>
> I haven't even looked at the callbacks yet.

This is how windows wndprocs work anyway.  Windows itself just has a
standard wndproc, but MakeObjectInstance in delphi gives you an address to a
"flat" wndproc which ends up calling your object's wndproc.

I'm suggesting a similar thing for GTK - except as it passes a DATA anyway
during its callback we don't have to bother directly with MakeObjectInstance
(yet, anyway).

Sam






More information about the Lazarus mailing list