Re: How can it do that?



On Sun, 20 Jan 2002 23:58:23 -0500 (EST)
Jamie Guinan <guinan bluebutton com> wrote:

> 
> Here's my take,
> 

> This creates a *new* GtkButton object.  The previous value of "button" is 
> lost now, but you must have attached the "first" button to a vbox or
> something when you said "...", so Gtk still has control of it!
> 
Hmm, I don't think that's the reason, AFAIK when you call:
	button=gtk_button_new_with_label("button1");
The "button" will point to the memory area where button1 (let's call like that)
is stored. After that, when you do the gtk_signal_connect, it stores a *pointer*
to the same memory area, like widget=button. And that pointer (widget) is sent
as an argument to the callback.

When you call:
	button=gtk_button_new_with_label("button2");
The "button" pointer now points to buttom2, but that doesn't destroy button1,
only changes where "button" is pointing to. That way, each button's callback
receives it's own widget pointer.

That's only my $0,02

-- 
=======================================================================
"There is no sadder sight than a young | rogbas at terra dot com dot br 
pessimist, except an old optimist."    | Registered Linux User #109537



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]