Re: [gtk-list] Global Variables
- From: Paul Bunyk <paul pbunyk physics sunysb edu>
- To: gtk-list redhat com
- Subject: Re: [gtk-list] Global Variables
- Date: Fri, 19 Mar 1999 22:52:40 -0500
This is what glade GUI builder does and I like this alot. E.g., you can
iterate over "all" sub-widgets (which cared to declare them "public" in glade
terminology) anbd change their appearancei with a single loop (I'm not sure if
this can be done right now, but in principle it is nice information to keep).
Paul
In a program I'm working on, I have about 20 or so widgets that need to
be accessible my multiple functions in multiple files. I've been using
global variables, but I recently saw the gtk_object_{get,set}_data functions
used instead.
For example, instead of having LocalEntry a global variable, the author
used
gtk_object_set_data(GTK_OBJECT(main_window), "LocalEntry", entry);
to store a pointer to the widget, and
entry = gtk_object_get_data(GTK_OBJECT(main_window), "LocalEntry");
to retrieve it.
Is there any actual benefit to doing this?
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]