Re: Trying to add widgets via callback
- From: Owen Taylor <owt1 cornell edu>
- To: Toshio Kuratomi <badger prtr-13 ucsc edu>
- Cc: gtk-list redhat com
- Subject: Re: Trying to add widgets via callback
- Date: 23 Feb 1998 19:45:16 -0500
Toshio Kuratomi <badger@prtr-13.ucsc.edu> writes:
> > vbox already is a pointer to your container, and the contents of
> > &vbox will be lost after newWindow is left because the it is a stack
> > variable.
> >
> Okay. That makes sense. But the three changes don't make my problem
> disappear. I still get the same error in the same place.
>
> Since vbox is a pointer to a container, will vbox disappear as well? Do I
> need to send a dereferenced vbox to my callback? How do I manage that?
> (gtk_signal_connect seems to expect a pointer as its fourth element).
No, the vbox won't disappear until the window that it is added
to is destroyed. (The subject is a bit more complex, but those
complexities (reference-counting) can be ignored for the moment).
*vbox is the structure in memory
vbox is the address of the structure in memory
&vbox is the address of the variable which holds the address
of the structure in memory.
If that seems confusing, I would suggest taking a look at a good
book on C. (Kernigan + Ritchie, 2nd ed is a traditional choice.)
[ No offense intended if this seems like easy stuff - I may
have misunderstood your question ]
You want to pass vbox to gtk_signal_connect.
With Tim's changes, it should work. If you are still having problems,
you might want to try posting the complete code of a minimal
example program that shows the behavior. (It's a little hard
to guess what you've omitted to save space, and what you
might be missing)
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]