Re: status/progress bars (revisited)



On Tue, May 15, 2001 at 07:53:54PM -0700, Matt Hillebrand wrote:
> I have been posting this question every few weeks for the past year, and I
> have never received a response:
> 
> How do I force a status bar (or progress bar) to update when the computer
> is really busy? I can tell the status bar to change right before I tell
> the CPU to begin a real work-out, and no matter what I try, the thing
> won't update until the latter CPU-intensive function is done. This
> is rather annoying because I am trying to tell the user that the computer
> is busy. This is really annoying, especially when I try to make the
> progress bar move in activity mode, and it won't budge because the CPU is
> busy. I can tell it start moving without stopping it, and it won't start
> moving until the CPU-intensive function call is done!
> 
> Please enlighten me!
> 
> Thanks,
> 
> Matthew P. Hillebrand

I am extremely certain there is a FAQ question (and answer) on this..
The gist of it is, a (single threaded) program can only do one thing at once, so while you're computing your ass off in that function gtk can't be looking after the gui.

The first solution is, modify your function to offer gtk a share of the cpu at strategic points (frequently). This is done with code like this:

while (gtk_events_pending ())
   gtk_main_iteration ();

The other solution is to make your app multithreaded with gtk running in one thread, and your function in the other.




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