|
View:
New views
2 Messages
—
Rating Filter:
Alert me
|
|
|
How to open a dialog box on button click eventHello friends,
I m a newbie to this mailing list and to glade development. For my project , i m using glade-3 and designed a basic window with a button and a dialog box. I don't know how to connect to dialog box on button click from my basic window. I m attaching .glade and .c file , plz help me out. Also, if you know any good tutorial for glade , for beginners like me , then plz send me link. Plz forgive me if i composed my mail or attachment in a wrong way. thanks in advance. [signal.c] #include <gtk/gtk.h> #include <glade/glade.h> void gtk_widget_show1(GtkWidget *widget, gpointer user_data) { // GladeXML *window; // GTKWidget *widget; // window=glade_xml_new ("signalevent.glade",NULL,NULL); // widget = glade_xml_get_widget (main_window, "mudialog"); printf ("Thanks for trying out my program.\n"); // gtk_window_set_default_size (GTK_WINDOW (dialog), 10, 20); gtk_widget_show(user_data); gtk_main_quit (); } int main (int argc, char *argv[]) { GladeXML *main_window; GtkWidget *widget; gtk_init (&argc, &argv); /* load the interface */ main_window = glade_xml_new ("signalevent.glade", NULL, NULL); /* connect the signals in the interface */ /* Have the ok button call the ok_button_clicked callback */ widget = glade_xml_get_widget (main_window, "button1"); g_signal_connect (G_OBJECT (widget), "clicked",G_CALLBACK (gtk_widget_show1),"mydialog"); /* Have the delete event (window close) end the program */ widget = glade_xml_get_widget (main_window, "window1"); g_signal_connect (G_OBJECT (widget), "delete_event",G_CALLBACK (gtk_main_quit), NULL); /* start the event loop */ gtk_main (); return 0; } _______________________________________________ Glade-devel maillist - Glade-devel@... http://lists.ximian.com/mailman/listinfo/glade-devel |
|
|
Re: How to open a dialog box on button click eventOn Mon, 2009-07-13 at 16:37 +0530, Nainesh Parekh wrote:
> Hello friends, > I m a newbie to this mailing list and to glade development. > For my project , i m using glade-3 and designed a basic window with a > button and a dialog box. > I don't know how to connect to dialog box on button click from my > basic window. > I m attaching .glade and .c file , plz help me out. > > Also, if you know any good tutorial for glade , for beginners like > me , then plz send me link. > > Plz forgive me if i composed my mail or attachment in a wrong way. > > thanks in advance. Your glade file a tad out of sync with the program. In the program you're connecting the signals manually. That's probably not what you want. All you need to do to connect the signals defined in the glade file is one call: glade_xml_signal_autoconnect (main_window); The g_signal_connect () function has nothing to do with glade. You can't just pass a widget name as a parameter to it and expect to get the widget as user_data in your callback. I can't give a recommendation for a particular tutorial. I do not know if there's any "official" one, but I'm sure if you just google for "glade tutorial" you'll find plenty. _______________________________________________ Glade-devel maillist - Glade-devel@... http://lists.ximian.com/mailman/listinfo/glade-devel |
| Free embeddable forum powered by Nabble | Forum Help |