Re: gui in fonction



On Tue, 18 Mar 2003, Axel wrote:

hi
I have a problem with fonction.
basically, i d like to use fonction to build my gui, so here is the function I d like to use

void create_window(GtkWidget *window)
      {
      window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
      gtk_widget_set_size_request(GTK_WIDGET(window),500,250);
      }

I call it in main() as following :

GtkWidget *window;
create_window(window);
gtk_widget_show(window);


the problem is that my program segfault.
No problem when I use gtk_window_new et set_size in the main().

So is it possible to build a gui in an external function ?  Where is my error ?

Hello,

  One solution could be : 


 GtkWidget *create_window()
       {
       GtkWidget *window;
       window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
       gtk_widget_set_size_request(GTK_WIDGET(window),500,250);
       return window;
       }

and in your main : 

 GtkWidget *window;
 window = create_window();
 gtk_widget_show(window);


regards

Vincent TORRI


Thanks in advance
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


-- 
TORRI Vincent
Mathematiques Appliquees Bordeaux                                                
Institut de Mathematiques                                                       
Universite Bordeaux 1                                                           
351 cours de la liberation                                                      
33 405 Talence cedex - France                                                   
                                                                                
Tel : 33 (0)5 57 96 21 42                                                       
Fax : 33 (0)5 56 84 26 26                                                       
--




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]