Home All Groups Group Topic Archive Search About

Modeless Dialog Not Responding

Author
6 Feb 2006 3:55 PM
Charles Law
The scenario is this:

My UI thread creates a worker thread that performs some tasks and
periodically updates the screen. All well and good, as it does this by the
usual Invoke mechanism. If I want to stop the background process, I can
click a button on the toolbar to stop it, as the UI is nice and responsive.

At some point, the worker thread becomes idle, waiting for an external
(non-user) event. At this time, I want a modeless dialog to appear, with a
message inviting the user to halt the task if required. The dialog just
contains a message and a stop button.

The problem is, when I display the dialog, it does not refresh, so does not
draw fully, and no amount of clicking on the button has any effect.

My toolbar buttons still respond, so why doesn't my dialog button do
anything?

I suppose I could stick a DoEvents somewhere, but I have an instinctive
dislike of this as a solution, as it seems to me that it frequently hides
the real problem, and possibly hides bad design.

Any and all suggestions welcome.

TIA

Charles

Author
6 Feb 2006 8:36 PM
NuTcAsE
Which thread are you displaying the dialog on? The worker thread or the
main form thread?

- NuTcAsE
Author
6 Feb 2006 10:47 PM
Charles Law
The dialog is created from the worker thread, but if there is a way for the
worker thread to create the dialog on the UI thread then that would be good.

Charles


Show quoteHide quote
"NuTcAsE" <rao.rit***@gmail.com> wrote in message
news:1139258205.854253.202530@z14g2000cwz.googlegroups.com...
> Which thread are you displaying the dialog on? The worker thread or the
> main form thread?
>
> - NuTcAsE
>