Re: progress bar help(tried FAQ & list)



Hello,

On Sun, 2002-01-27 at 13:19, A R Hummaida wrote:
> i have tried both FAQ & this list for the following. i have a progress 
> bar on the activity mode which i want to be displayed during some heavy 
> computation. i know that i can drive the progress bar from within the 
> computation but i rather not do that.
[snip]
> i would like the progress bar to be active during the 
> "complex_function()".if the timeout is not being called during the 
> complex function then how could i solve that without manually calling 
> the main iteration from within the complex function?

Use threads (pthread)... The "heavy_computation" should become a
seperate thread which uses something like signals to the main thread
(either Gtk+ code or pthread_cond_t-based code) which can then update
the GUI (since gtk_main() is in the main thread and is idle - drawing
will *only* be done when gtk_main() is idle!!!)... This is how I do it
in my application - it works great. Things like while(...)
gtk_main_iteration(); have never worked very well for me... If you're
gonna use gtk-signals, don't forget to call
gdk_threads_enter()/gdk_threads_leave() as described in the FAQ.

Ronald

-- 
-   .-.
-   /V\    | Ronald Bultje <rbultje ronald bitfreak net>
-  // \\   | Running: Linux 2.2.19 and OpenBSD 3.0
- /(   )\  | http://ronald.bitfreak.net/
-  ^^-^^




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