On Fri, 28 Mar 2003 12:03:10 -0600 "Childers, Matthew" <mchilders bentonville k12 ar us> wrote:
Now, three years later I have taken up C again (dusting off the old textbooks) and am getting into GTK. I have been playing around with test programs and need some program design advice. I have a couple widgets that when I press a button, I want them to disappear. However, with the g_signal_connect function, I can't seem to find a way to pass a pointer of each of these widgets that I want hidden. What I end up doing is creating a global variable for each widget that I want hidden and hiding them with a callback function.
You could use g_object_set_data(G_OBJECT(widget), "key", pointer) to store the pointers to the widget, each with a different "key", if you _really_ do not want to use global variables. But I do not think that using globals is inherently evil. Read §1.10 from "the C programming language" for more info on scope of variables. Roland -- R.F. Smith /"\ ASCII Ribbon Campaign r s m i t h @ x s 4 a l l . n l \ / No HTML/RTF in email http://www.xs4all.nl/~rsmith/ X No Word docs in email / \ Respect for open standards
Attachment:
pgp_7wjkFdiLX.pgp
Description: PGP signature