Modeless Dialog Not Responding

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
 
N

NuTcAsE

Which thread are you displaying the dialog on? The worker thread or the
main form thread?

- NuTcAsE
 
C

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top