Re: gtk_drawing_area_new()



Russell Shaw wrote:

Hi,
In this code, grid->window is NULL (in gdk_draw_rectangle). Is a parent
widget needed to inherit the window from?

    GtkWidget *grid=gtk_drawing_area_new();
    gtk_widget_set_size_request(grid,100,100);
    gdk_gc_set_foreground(gc,&(obj->background.col));
gdk_draw_rectangle(grid->window,gc,TRUE,0,0,grid->allocation.width,grid->allocation.height);

Your widget just not realized. Connect to "realize" signal to be sure that GdkWindow for this widget (or his parent in case of GTK_NO_WINDOW widgets) is created. You also can check that the widget is realized by GTK_WIDGET_REALIZED() macro.

   Olexiy





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