Skip navigation.
 
mlRe: How to make a blue (active) progressbar within a hotloop?
FROM : Michael Ash
DATE : Thu Jun 08 20:26:39 2006

On 6/8/06, Theodore H. Smith <<email_removed>> wrote:
> Hi list,
>
> I have some code which has a hot loop in it.
>
> I want to open up a window, during the hot loop, display a progress
> bar during the loop, and then close the window.
>
> My current attempt works, but the window seems to not get an activate
> event, or something like that, because all the controls are disabled
> as if it's not the key window. I am actually calling
>
> [w makeKeyAndOrderFront:0];
>
> on it!
>
> Any idea how to do this progress bar during a hotloop?
>
> I'm thinking of just starting from scratch, not even trying to fix my
> progress code as I have no idea what is wrong with it (it's only
> small anyhow), and doing it a different way.


Put your window on-screen and make it modal by using NSApp's
beginModalSessionForWindow: method. Then whenever you 'idle', which
would probably be when you update your progress bar, use
runModalSession: to let events get processed and windows get updated.
As a bonus, not only will things update properly but you will no
longer get the Spinning Pizza of Death while the window is up, and
it's easy to implement things like a Cancel button if you should so
desire.

Mike

Related mailsAuthorDate
mlHow to make a blue (active) progressbar within a hotloop? Theodore H. Smith Jun 8, 17:30
mlRe: How to make a blue (active) progressbar within a hotloop? Michael Ash Jun 8, 20:26
mlRe: How to make a blue (active) progressbar within a hotloop? Theodore H. Smith Jun 8, 21:07