"Thomas J Lewis" <[EMAIL PROTECTED]>Wrote:
> what other procedures are available in glade besides lookup_widget.
>
> also, if there are several buttons which call the same callback,
> how is the button label/name determined?
>
> in peter wright's book, beginning gtk+/gnome, pg 452,
> he uses buttons unique name to determine button.
>
> in my case, all the button labels are the same.
> only the glade button name, defined on the widget properties window,
> is different.
The routine lookup_widget() will return a pointer to a GtkWidget if you
know its name. In a signal handler you already have that information.
The first parameter of a button signal handler is a pointer to a GtkButton
structure.
Each of your buttons have unique GtkButton structure with names like
button1,
button2, .. unless you modified the one assigned by Glade. This can be
found in
the Glades Properties:Widget:Name field. You can access a button's widget
name
in a buttons clicked signal handler as follows:
void on_button_clicked(GtkButton *button, gpointer user_data)
{
GtkBin *bin;
GtkContainer *container;
GtkWidget *widget;
gint i;
bin = GTK_BIN(button);
container = GTK_CONTAINER(bin);
widget = GTK_WIDGET(container);
i = atoi(&widget->name[6]);
printf("Button %d '%s' was clicked.\n", i, widget->name);
}
If button 5 was clicked the above code would print...
Button 5 'button5' was clicked.
Terry
_______________________________________________
Glade-devel maillist - [EMAIL PROTECTED]
http://lists.helixcode.com/mailman/listinfo/glade-devel