Owners and Parents Was: Re: [lazarus] Creating Components...

Marc Weustink weus at quicknet.nl
Fri Aug 13 15:32:10 EDT 1999


At 14:00 13-08-99 -0400, you wrote:
>On 8/13/99, at 7:16 PM, Marc Weustink wrote: 
>
>All of the deleted part is understood.
>
>>>How
>>>do you, after the create, tell a window that it has a parent, when it did
>>>not have one when it was created?
>>
>>like line 3 and 4.
>
>No, not the object, the window, the thing pointed to by the HWnd handle.  
>When you call CreateWindow, you pass either a parent window handle, or you
>pass 0 for no parent. 

In fact you do. The desktop will function as a kind of a parent.

>If you create the handle with a 0, can you change the window parent later? 

First I think the window shouldn't be created by then. Create it when it
has a parent (it has no graphical function anyhow) 
But if you have to .... 
You can change the parent of any window whose hwnd you know to any other
parent by  the winapi function SetParent:

HWND SetParent(
    HWND hWndChild,	// handle of window whose parent is changing
    HWND hWndNewParent 	// handle of new parent window
   );	
 


>If so, how?  This has nothing to do with the TWinControl or whatever object,
>only the HWnd data.

Marc







More information about the Lazarus mailing list