Re: [gtk-list] Effecting more than 1 GTK object when a button is clicked




Matthew Cordes <mcorde61@maine.edu> writes:
> Am I correct in assuming that if  I want a button click to grab data from
> a number of GkEntry boxes, then display the output on a GtkText widget
> and have the Window created in a separate file from my callbacks (and
> main) I need to make the widgets global throughout the files via extern?
> Or is it possible to pass a number of objects via a callback? Or is there
> some sort of central table of all widgets I create that I can access by
> name?
> 

Any of those things will work, but GTK doesn't do any of them for you.

You can use global variables; you can create a data type that contains
a number of widgets inside, then pass that around to your callbacks;
you can make a GHashTable that maps names to widgets. You can also use
gtk_object_set_data()/gtk_object_get_data(). All valid approaches.

The subjective which-should-I-use-when issue is a matter of taste and
experience, read some code like the Gnumeric code to get a sense of
things.

Havoc



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