[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
  Web www.spinics.net

Re: GTK_ENTRY text retrieval

On Tuesday 30 November 2004 12:06, Kenneth Sodemann wrote:

> If you build a simple interface with glade and then look at the generated
> code and look at it, you will find the generated code is basically saving
> the widget pointers as object data.  I thought that was a neat idea, and
> adopted it in my own code.  Then all I have to do is pass the main parent
> widget around and lookup the widgets from there as needed.

You could also allocate yourself a custom-made struct containing all the 
widgets you need access to, and pass that struct around instead. Something 

    gtk_widget_show (foo->treeview);

is usually more readable than code littered with g_object_get_data() like

    gtk_widget_show (GTK_WIDGET (g_object_get_data (G_OBJECT (win), 

> You might want to generate some code from glade and take a look...

I think in general it makes more sense to look at code that was written by 
experienced programmers rather than to look at generated code ... 


Obligatory disclaimer: don't generate code with glade, use libglade to read in 
the Glade-generated .glade XML UI description at startup ;-)


[GIMP Users]     [Yosemite News]    [Yosemite Photos]    [Gimp's Home]     [Steve's Art]

Add to Google Powered by Linux