Re: "losing" widget names

>Ok, I got moving widgets from one container to another to work.  The
>gtk_widget_reparent() worked fine.
>Now, I want to ONLY create the new window (and widgets) if they don't
>already exist.  I've tried this:

   [ ... ]

i've never seen any GTK+ code that uses the lookup_widget()
approach. its much more conventional to do this:

	  typedef struct {
	     GtkWidget *inventorywindow;
	     GtkWidget *inventoryframe;
          } ACollectionOfMyWidgets;

	  ACollectionOfMyWidgets the_widgets;

	  int create_my_widgets (ACollectionOfMyWidgets* collection) {
	      collection->inventorywindow = gtk_window_new (...);
	      collection->inventoryframe = gtk_frame_new (...);

then you either make "the_widgets" global, or you pass i around to
functions as needed (for example, as the "user_data" pointer to a
signal handler).

i don't know why the name lookup fails, and it seems that it should
work, but i'm not sure its the most efficient or flexible approach.


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