Re: Iterating through children
- From: Gus Koppel <gtk spamkiller bytechase cx>
- To: gtk-app-devel-list gnome org
- Subject: Re: Iterating through children
- Date: Fri, 17 Oct 2003 20:39:21 +0200
Dimitar Haralanov wrote:
1. my function operates independently from Glade, has no particular
external references and doesn't need any extra precautions like
Glade's GLADE_HOOKUP_OBJECT lists.
This is not entirely accurate, unfortunately (at least in my
case). Using your function, I can't just find any widget!
gtk_widget_get_name() returns the type of the widget that I am
passing to it and not the name of the variable which points to
the widget. For instance, if I have the following;
GtkWidget *widget;
gchar *name;
widget = gtk_check_button_new ();
name = gtk_widget_get_name (widget);
Now name will contain 'GtkCheckButton' and not 'widget'.
Of course. Custom widget names are not assigned by default. They have to
be specified with gtk_widget_set_name (), preferrably at construction
time of the widget. Just name your widgets and you will be able to refer
to them by name.
By "no extra precautions" I was referring to custom extra operations
beyond internal GTK functionality, like Glade's add ons. Names, however,
are a GTK-provided standard property of all widgets. Code created by
Glade always assigns widgets unique (but not comprehensible) names. It's
your responsibility to name widgets so that you can refer to them later.
Note that the names of your C source code variables and the names of
widgets are two completely independent items. C variable names are of
importance / existance only during compile and link time. Widgets (and
their names) only exist at runtime of your application.
See:
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-set-name
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]