Re: help on gtk.
- From: Sergei Steshenko <sergstesh yahoo com>
- To: sameer tandra <sameer tandra gmail com>, gtk-list gnome org
- Subject: Re: help on gtk.
- Date: Wed, 13 Sep 2006 04:47:25 -0700 (PDT)
--- sameer tandra <sameer tandra gmail com> wrote:
> Hi I am Sameer.
> I am working on GTK. I have a problem when running
> the program i.e "Segmentation Fault".
>
> I am trying to add two buttons to the container window.First the window is
> displayed but when i tried to append the buttons to container it is giving
> runtime error.
>
> The program is as follows:
>
> #include <gtk/gtk.h>
>
> static void callback( GtkWidget *widget,
> gpointer data )
> {
> g_print ("Hello again - %s was pressed\n", (char *) data);
> }
>
> int main( int argc,
> char *argv[] )
> {
> GtkWidget *window;
> GtkWidget *button;
> GtkWidget *table;
>
> gtk_init (&argc, &argv);
>
> window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
> gtk_window_set_title (GTK_WINDOW (window), "Table");
> g_signal_connect (G_OBJECT (window), "delete_event",
> G_CALLBACK (delete_event), NULL);
> gtk_container_set_border_width (GTK_CONTAINER (window), 20);
> table = gtk_table_new (2, 2, TRUE);
> gtk_container_add (GTK_CONTAINER (window), table);
> button = gtk_button_new_with_label ("button 1")
> g_signal_connect (G_OBJECT (button), "clicked",
> G_CALLBACK (callback), (gpointer) "button 1")
> gtk_table_attach_defaults (GTK_TABLE (table), button, 0, 1, 0, 1);
> gtk_widget_show (button);
> button = gtk_button_new_with_label ("button 2");
> g_signal_connect (G_OBJECT (button), "clicked",
> G_CALLBACK (callback), (gpointer) "button 2");
> gtk_table_attach_defaults (GTK_TABLE (table), button, 1, 2, 0, 1);
> gtk_widget_show (button);
> gtk_widget_show (table);
> gtk_widget_show (window);
> gtk_main ();
> return 0;
> }
>
> please help me.
>
> thanks in advance.
>
>
> regards,
>
>
> Sameer.T
> > _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list
>
What about using a debugger (gdb, DDD, etc.) ?
--Sergei.
Applications From Scratch: http://appsfromscratch.berlios.de/
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]