Re: problems changing cursor in scribble-simple.c



on 2/26/01 9:18 AM, Cevat Ustun at ustun Glue umd edu wrote:

In an attempt to change the cursor in scribble-simple.c,
I added the following declaration

    GdkCursor *cursor;

and the following lines after the drawing_area declaration:

    new_cursor=gdk_cursor_new(GDK_CROSS);
    gdk_window_set_cursor(drawing_area->window, new_cursor);
    gdk_cursor_destroy (new_cursor);

but I get the error

    Gdk-CRITICAL **: file gdkwindow.c: line 1274
    (gdk_window_set_cursor): assertion `window != NULL' failed.

When a widget has not yet been realized, the window is not yet allocated.
You must make your gdk_window_set_cursor call after the widget is realized.
One fix might be to call gtk_widget_realize on the drawing area first. I
believe that will work as long as it's already parented all the way up to
the GtkWindow level.

    -- Darin





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