Re: closing a spawned window



Ronald Roth wrote:

Use:
 g_obgect_set_data(G_OBJECT(widget), (gpointer *)other_widget)
when you get your handle 

and in your callback:
 other_widget = (GtkWidget *)g_object_get_data(widget);

actualy go see "g_obgect_set_data_full" to avoid memory leeks

        -Tristan


Hello,

I have an application which spawns another toplevel window.  I would
like the user to be able to close this window by clicking on
File->Close.  I currently have the callback for that menuitem call
another function which does some cleanup (Saving date, etc), and then I
wish to close the window.  However, I don't know what to pass to
gtk_widget_destroy().  The only data that's available in my callback is
the GtkMenuItem that was clicked.  How do I get the widget that I need
to delete the toplevel window?

I often have problems like these.  I have a button whose callback needs
data about some other widget elsewhere in my program.  In general, how
do I pass this data to my callback or retrieve the data from within the
callback?

Thanks!  I hope my question was clear.  Please forgive me if the answer
is obvious.

Ron
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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