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

Re: Accessing widgets in a property box



On Thu, 24 Feb 2000, Jeff W. wrote:

> in a property box, how would I access the various widgets I have there,
> from within the apply function that is triggered when the user clicks
> the button?  Maybe something like: 
> get_text(PropertyBoxName->widgetName)??????
> 

	Maybe you should consider using libglade for such kind of
work. With libglade you can get a widget by its name with:
	glade_xml_get_widget (xml, "widget name");

	Without using libglade, the best way is to do a
gtk_object_set_data (GTK_OBJECT (dialog), "name", widget); for all
widgets. In the callback

void callback (GtkWidget *some_button)
{
   GtkWidget *dialog, *wid1, *wid2...;

   dialog = gtk_widget_get_toplevel (dialog);
   wid1 = gtk_object_get_data (GTK_OBJECT (dialog), "wid1 name");
   wid2 = gtk_object_get_data (GTK_OBJECT (dialog), "wid2 name");
   ...
}

	Of course, there are more ways of doing it.

-- 
Gustavo J.A.M. Carneiro
[reinolinux.fe.up.pt/~ee96090]
                                       



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