Re: non-interactive drawing area



On 2003-08-24 14:39:05, Carlos Pereira wrote:
By default, a DrawingArea is non-interactive, it starts
to be interactive only when you connect signals. Usually 
you would connect a DrawingArea to the signals below 
(taken from my own code).

hmm, if I want to draw on the DrawingArea, the following error appears:

(test:6010): Gdk-CRITICAL **: file gdkdraw.c: line 410
(gdk_draw_rectangle): assertion `GDK_IS_DRAWABLE (drawable)' failed

code example:

int main(int argc, char *argv[])
{
    GtkWidget *window, *darea;
    gtk_init(&argc, &argv);

    window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
    gtk_container_set_border_width(GTK_CONTAINER(window), 10);

    darea = gtk_drawing_area_new();

    gdk_draw_rectangle(darea->window, darea->style->white_gc, TRUE,
            0, 0, darea->allocation.width, darea->allocation.height);

    gtk_container_add(GTK_CONTAINER(window), darea);

    gtk_widget_show(darea);
    gtk_widget_show(window);

    gtk_main();

    return 0;
}

-- 
cu,
Johannes WeiÃl



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