Re: Unidentified subject!
- From: Owen Taylor <otaylor redhat com>
- To: "Ian P. Johnson" <johnsoip clarkson edu>
- Cc: gtk-devel-list redhat com
- Subject: Re: Unidentified subject!
- Date: 17 Apr 2000 11:07:55 -0400
"Ian P. Johnson" <johnsoip@clarkson.edu> writes:
> I'm sorry to post this quertion but I can't find an answer anywhere else
> so I thought if the answer was anywhere it would be here.
>
> Q: I have a GtkLabel that I need to update rapidly. How do I go about
> forcing the label to repaint. What is the best solution?
Well, a lot of answers are here, but just because they are here, doesn't
mean that this list should be cluttered with him.
This list is about the development of GTK+ itself, not about the
development of programs with GTK+.
Please address such questions to gtk-list in the future.
But, a completely content-less reply, I'll add an on-topic remark:
For GTK+-1.4, the most efficient way to do it will look like:
if (GTK_WIDGET_REALIZED (label))
{
GtkWidget *window_widget = label;
while (GTK_WIDGET_NO_WINDOW (window_widget))
window_widget = window_widget->parent;
gdk_window_process_updates (window_widget->window, FALSE);
}
We probably should add a gtk_widget_process_updates() function that
does this.
For GTK+-1.2, you can change
gdk_window_process_updates (window_widget->window, FALSE);
to
gtk_widget_draw (window_widget, NULL);
Which isn't as efficient, but will work.
Actually, for either GTK+-1.2 or GTK+-1.4, doing this is pretty
suspect, because you are updating the label, but nothing else in your
interface. Which look very odd if there are exposure events waiting to
be processed.
So, what you simply should do, for both versions, is:
while (g_main_iterate (FALSE))
/* Nothing */;
Which tells GTK+ - "process all pending events, resizes, and redraws"
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]