discarding user actions on a form while in busy state

C

CBanu [IXIA]

Hi,

I can't seem to figure out a decent way to do this. I have a small
window, and I need to discard user input while performing some lenghty
task. For example, if the user wants to sync the app with a server, and
this takes time. The proper behavior would be to change the cursor to a
busy cursor, and prevent the user from touching any control on the
form. Of course, painting should still be done, and the form should be
able to move and resize (user actions like move, resize, maximize,
minimize). When the job is done, the cursor changes back to the default
one, and the user is able to interact with the received data.

I've seen various sugestions:

- disable the controls (or the whole form): not good, as the appearance
of the controls changes dramatically; also, there seems to be problems
with the cursor, it won't show properly on a disabled control (it
displays the default cursor, not the one I set);

- put a transparent form on top of the current form: I'm interested in
this, if anyone can provide bits of code, I would really appreciate it.
However, I don't know if this is supported on all systems (I'm
interested mainly in XP, Win2003, and maybe Win2000).

- catch all events in a WndProc: how do I do this? I've overriden the
WndProc of my form, yet not all messages pass through this. I am still
able to interact with the controls...

I really appreciate any help on this, guys (and girls). :)

Cheers,
Cosmin.
 
P

Pritcham

Hi Cosmin

Couple of additional suggestions for you:

1) Pop up a modal form ontop of your main form - this modal form would
display a message to the user and (maybe) a progress bar.

2) Add an additional check to your controls to check whether the
long-running process is happening, if so then ignore the user input

3) Move the long running process into a background worker (separate
thread) so that the user can continue to work with the app - this
naturally depends on the nature of the long-running task.

One thing to be wary of though is that if you're trying to stop the
user from doing anything (other than resize/move) while this process is
running then you need to make it clear to the user that this is
happening otherwise they may think that the application has just
stopped responding. Most users are used to the appearance of disabled
controls and this would naturally signify to them that they can't
(currently) use those controls.

HTH
 

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