Modeless Dialog Not Responding

  • Thread starter Thread starter Charles Law
  • Start date Start date
C

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
 
Which thread are you displaying the dialog on? The worker thread or the
main form thread?

- NuTcAsE
 
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
 
Back
Top