[Glade-users] lookup_widget function



Roel wrote:

Hi all,

I'm learning glade/libglade, and I have some problems using the
lookup_widget function; I basically get error messages that the widget can
not be found. The way I call the function is as follows:

ent_tab_title = lookup_widget (GTK_WIDGET(button), "ent_tab_title");

where "ent_tab_title" is the name that I gave the entry in glade. I did not
do a glade_xml_get_widget() on this entry box, only on the parent window.
Could this be my problem? If I have to do glade_xml_get_widget(), then
where should I declare the widget (I'm trying to use this function to avoid
global widgets)?

Are you using Glade-generated source code or libglade?

If you are using Glade-generated code you use lookup_widget().
If you are using libglade you use glade_xml_get_widget().

They store the widget pointers in different places. 



A related question (although more gtk then glade specific)
is what the last  argument to gtk_object_get_data (GTK_OBJECT (widget),
widget_name); should be. Is it the name that I give the widget in Glade? I
tried to change the lookup_widget function to call this object_get_data
function with "ent_tab_title" as an hardcoded string argument, but that did
not make any difference. I hope everybody can understand what I mean
because english is not my native language :-(

gtk_object_get_data() & gtk_object_set_data() allow you to store any data with
a widget, using a textual key.

Glade uses it for storing pointers to all the widgets in a window, with the name
you gave them in the property editor as the key. But you can use it for other
things.


Damon







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