[lazarus] Creating Components...
Curtis White
osiriz at teleport.com
Wed Aug 11 21:19:15 EDT 1999
Michael can probably give you a better answer to this since he knows the gtkint
internals really well, but here are my ideas on it anyway.
On 12-Aug-99 Jeffrey A. Wormsley wrote:
>
> My problem is the way in which messages are sent to create the button. The
> first message sent is the LM_CREATE, then the LM_ADDCHILD to tell the
> button what it's parent is. However, win32 wants to know the window handle
> of the button's parent when the button is created. I don't have that
> information yet!!! I won't get that until the LM_ADDCHILD message is
> recieved. I have all of the other data needed, such as the size and the
> position of the button, but not the parent. The net result is that I get
> the main form and a very small form that contains the button, since windows
> creates a form to go around the button because it has no parent.
I would say to just create the button in the LM_ADDCHILD message and do nothing
in the LM_CREATE message. Either that or send the parent information with the
LM_CREATE message and then do nothing in the LM_ADDCHILD message. If it is
possible, I think it would be better to pass the parent info along with the
LM_CREATE message and create it there and leave the LM_ADDCHILD message blank.
That would be a more appropriate location to create the control. I just don't
know if this is possible or not.
>
> Must I move the creation of the button to the LM_ADDCHILD handler? Will
> this cause problems if the button has it's parent changed?
I can't think of any reason it would cause problems if the parent changed. The
control will know who its parent is. The message handler won't be tracking who
the parent of each control is, will it?
>
> How much code does it break to have the buttons parent already assigned to
> the Parent property before the call to SendMessage is made?
>
I don't think this will really hurt anything either. The control doesn't really
expect its parent to be assigned until the end of the Create statement. The
only place where I can think that this could break some code is if in the
Create statement for a control, there is a reference to the Parent before the
AddControl function. But that shouldn't be the case anywhere anyway. And if it
is, we should probably fix it.
Like I said, Michael may shed a whole new light on this, but this is from my
limited understanding of how the message handling currently works with the gtk
units.
Curtis
More information about the Lazarus
mailing list