Re: Status for long-running operation



Jeffrey Barish wrote:

> My application has one operation that runs for a long time (~1 minute).
> During this time, the user is not allowed to do anything.  Nevertheless, I
> felt that it was important to give the user some feedback that the
> application is still alive and that the operation is running.  My solution
> was to print a message in a TextBuffer and follow the message with a
> string
> of dots that grows in length by one every second.  To get the TextView to
> update, I used events_pending/main_iteration.  This all works nicely.
> However, because of the events_pending/main_iteration statements, the
> entire
> GUI is now alive.  Thus, the user is able to do things that disrupt the
> long-running operation.  Basically, what I want is a way to get the
> TextView to update so that I can update the progress indicator but for
> everything
> else still to be locked out.  Is there a way to do this?

Here's a possibility that seems to work:

I used event_handler_set to define an event handler that filters out all 
events (by not calling main_do_event) except EXPOSE while the long-running 
operation is underway.  I wish that there were a way to restore the default 
event handler, but there is only a set method.  Anything bad about this 
solution?
-- 
Jeffrey Barish



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