|GUI not refreshing during long-running operations [message #137645]
||Mon, 29 September 2003 21:33
Originally posted by: kharris.unveil.com|
I have a wizard which performs some long running operations when one pages
from one wizard page to the next. I have the body of each of these
operations in an IRunnableWithProgress and get progress updates which
advance the wizard's progress monitor as expected. The problem arises when I
select another window on my desktop. If I select my wizard again, the dialog
is not refreshed. If the window I previous brought into focus overlapped the
wizard, when I bring the wizard back into focus the region of overlap is now
completely blank. The GUI does not refresh itself until there's a progress
monitor update (which for me is somewhat infrequent.) Is there some way to
grab the focus event and refresh the GUI?
Also, the wizard dialog has a cancel button, but it's disabled during
long-running operations. Is there any way to enable it and interrupt the
|Re: GUI not refreshing during long-running operations [message #144436 is a reply to message #144259]
||Wed, 15 October 2003 15:21
Originally posted by: richkulp.NO--SPAM.us.ibm.com|
It is because you are not running the read/dispatch loop. The
read/dispatch loop handles requests that are queued up, including the
give focus request and paint requests. When doing the monitor.worked(1)
it probably just does an immediate paint to the monitor, the rest of the
ui is starved of events. And since the rest of the ui hasn't changed or
been covered, it looks like it is active and maintained, but it isn't.
It is just whatever it was last before your operation started.
That is why you should never do long running things in the ui thread, it
starves the read/dispatch loop and events do not get processed.
Powered by FUDForum
. Page generated in 0.01883 seconds