Re: forcing immediate redraw on widget



Marc Santhoff wrote:

How can the immediate redraw of a widget be forced using GTK+ 1.2?

I think the following should work in GTK+ 1.2 and 2.x:

    gtk_widget_queue_draw (widget_to_redraw);
    while (gtk_events_pending ())
        gtk_main_iteration ();

Thank you for answering, although after testing this seems to be only
one half of the solution.

The other half would be to invalidate or mark the widget for
redrawing, so that there are events to process. Apparently changing
the background color on a widget (hscale in this case) does not do it.

Have you included the first half (the call to gtk_widget_queue_draw ())
into your test? Just changing simple attributes isn't enough indeed to
force a widget to be redrawn. gtk_widget_queue_draw () is supposed to do
excatly what you were suggesting: invalidate the the widget for
redrawing. See:

http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-queue-draw
http://developer.gnome.org/doc/API/2.0/gtk/GtkWidget.html#gtk-widget-queue-draw-area

If it still doesn't work using gtk_widget_queue_draw () I suspect either
a deficiency of GTK+ 1.2 or another bug in your program.



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