RE: [gtk-list] Abstracting the data from the ui..





> -----Original Message-----
> From: Sean Cody [mailto:umcodysw@cc.UManitoba.CA]
> Sent: Tuesday, October 26, 1999 5:01 AM
> To: gtk-list@redhat.com
> Subject: [gtk-list] Abstracting the data from the ui..
> 
> 
> I trying to write some generic interfaces for a set of UI 
> windows though I
> cannot seem to be able to pass data back and forth properly.
> 
> Here is what I am doing.
> 
> get_some_data(&MyDataStructure)
> {
>  GtkWindow *MyWindow = gtk_window_new(GTK_WINDOW_TOPLEVEL);
>  create widgets here ....
>  add signal's here
>  MyDataStructure refresh...?
> }
> 
> How do I actually update the data once the window is closed? 
> (Is all data
> intended to be global and all windows modal??)  Most of the 
> data I would
> deal with is from dialog boxes who's input isn't needed until the
> dialog/window has been closed/destroyed.
> 
> Your friendly neighbourhood posix junkie,
> 

Hi,

You can add data to GtkObjects by using gtk_object_set_data (or *_add_data...). It requires you to add a piece of data with a name (or use gtk_object_set_user_data).

Well, if you want to extract data from widgets, just add the widget as data to (for example) the window (or its parent). If you want the widget again, use gtk_object_get_data (). That's the way GLADE does it...

You can do the same trick with your own data structure of course.

regards,

Arjan



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