Re:

Date view Thread view Subject view Author view

From: Damon Chaplin (damon@karuna.freeserve.co.uk)
Date: Thu Aug 05 1999 - 14:14:47 EDT


vovin@footek.dhs.org wrote:
>
> So here is another question... :)
> How do i connect a signal to a button on a gnome dialog window?
> This code doesn't work.
>
> void
> on_preferences1_activate (GtkMenuItem *menuitem,
> gpointer user_data)
> {
> GtkWidget *dialog1;
> dialog1= create_dialog1 ();
> gtk_widget_show(dialog1);
>
> gtk_signal_connect (GTK_OBJECT (button1), "clicked",
> GTK_SIGNAL_FUNC (gtk_widget_hide(dialog1)), NULL);
>
> }
>
> Since button1 is undeclared by some reason.. :(

All widgets are only declared locally in the function in which they are
created.

But Glade stores pointers to widgets in the datalist of the toplevel
window/dialog, keyed on the widget names. You can use the lookup_widget()
function to get a pointer to the widgets, e.g.

  GtkWidget *dialog1, *button1;

  dialog1= create_dialog1 ();
  gtk_widget_show(dialog1);
 
  button1 = lookup_widget (dialog1, "button1");
  gtk_signal_connect_object (GTK_OBJECT (button1), "clicked",
                             GTK_SIGNAL_FUNC (gtk_widget_hide),
                             GTK_OBJECT (dialog1));

 
> If some one would tell me how to do this i would be very happy :)
> By the way, is it glade-devel or glade-list this kind of question should
> go?

glade-devel is OK. glade-list was initially just for announcements, though
I think it should be changed to cover using Glade.

Damon

+---------------------------------------------------------------------+
To unsubscribe from this list, send a message to majordomo@ncis.pn.org
with the line "unsubscribe glade-devel" in the body of the message.


Date view Thread view Subject view Author view

This archive was generated by hypermail 2b29 : Tue Aug 01 2000 - 19:21:52 EDT