Re: gui in fonction



On Tue, 18 Mar 2003 11:30:59 +0100
Axel <axel azerty netcourrier com> wrote:

hi
I have a problem with fonction.
basically, i d like to use fonction to build my gui, so here is the
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 ?

You'd have to do something like this...

#include <gtk/gtk.h>
void create_window(GtkWidget **window)
{
        *window=gtk_window_new (GTK_WINDOW_TOPLEVEL);
        gtk_widget_set_size_request(GTK_WIDGET(*window),500,250);
}
        
int main(int argc, char *argv[])
{
        GtkWidget *window;
        gtk_init (&argc, &argv);
        create_window(&window);
        gtk_widget_show(window);
        gtk_main();
        return (0);
}



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