Re: 'refreshing' a widget



There are a few ways to do that. Ususaly
you would use a g_io_add_watch or gdk_input_add
unless your process blocks a long time on IO.

If you absolutly need to do it in another thread
you could put a g_cond_wait(condition) in your
main thread and use g_cond_signal(condition) to
unblock the main thread (i.e. g_cond_wait() will return)
_or_ a popular hack is the following few lines:

while (gtk_events_pending())
        gtk_main_iteration_do(TRUE);

this will clear up the queue of events in the main loop
Cheers
        -Tristan

G Hasse wrote:

On Tue, 17 Sep 2002, Dave Cunningham wrote:

Hi,

I'm writing a program where widgets are altered by a thread other than
the main gtk loop. (The thread reads a joystick device, and sleeps until
a button is pressed).

First. You don't need a thread. Use "gdk_input_add" to watch for
data on the file descriptor.

I find that the display is never updated until something happens in the
main loop, and presumable an expose event is emitted or something.

You can emit signals to widgets yourself. Look for a suitable
method.

It is quite easy to write your own widget. We have written a lot of
them and if you give me a hint we might have someting that you
easy could modify.

http://www.raditex.se/bilder/process1.png

Göran Hasse

----------------------------------------------------------------
Göran Hasse            email: gh raditex se     Tel: 08-6949270
Raditex AB             http://www.raditex.se
Sickla Alle 7, 1tr                              Mob: 070-5530148
131 34  NACKA, SWEDEN

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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