[Glade-users] Display Updates with muti-threads
- From: damon karuna uklinux net (Damon Chaplin)
- Subject: [Glade-users] Display Updates with muti-threads
- Date: 06 Apr 2003 14:39:33 +0100
On Thu, 2003-04-03 at 00:34, Jim Deas wrote:
I am having trouble with display updates.
I want to update a text window and a progress bar
once per second with new data.
I have written a routine that changes the
data then calls gtk_widget_show_all(display) or
gtk_widget_show(display).
These display
routines are in a different thread created by
the main thread that owns the GUI.
The problem is that the display still does not update
unless I move the mouse somewhere on the window.
Is this due to the fact that a different thread
created the window than the one requesting gtk_widget_show?
If so, how do I fix this. Do I have to somehow signal the
base thread and have it issue the gtk_widget_show command
itself?
Make sure you call call g_thread_init() and gdk_threads_init() before
any GTK+ call, and that you use gdk_threads_enter()/gdk_threads_leave()
when necessary. See the GDK API docs (on developer.gnome.org).
gtk_widget_show_all(display) and gtk_widget_show(display) are only used
to initially show the widget. They aren't used for refreshing a widget.
If you are using the normal GTK+ text and progress bar widgets, they
should update themselves, without needing to call any function to
refresh the display (as long as you don't block the main thread, which
handles display updates).
I'd guess that in your case GTK+ has got confused, probably because you
haven't used gdk_threads_enter()/gdk_threads_leave() properly.
Damon
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]