By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,333 Members | 1,850 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,333 IT Pros & Developers. It's quick & easy.

Preventing user interaction while showing a "wait" cursor

P: n/a
I have a form which performs some asynchronous code. I want to display a
wait cursor when it starts, and hide the wait cursor when it has completed.
This part works fairly well, using:

this.TopLevelControl.Cursor = System.Windows.Forms.Cursors.WaitCursor;

I also want to prevent user interaction with the controls on my form while
the wait cursor is displayed, so that use events (except resize and cancel)
are blocked. What is the recommended way of doing this in .NET?

Thanks,
Aaron Queenan.
Nov 15 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
You can set the Enabled property of a control or even a form to false. This
will prevent any user interaction.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Aaron Queenan" <aq*********************@contingent.com.au> schreef in
bericht news:Oh**************@TK2MSFTNGP12.phx.gbl...
I have a form which performs some asynchronous code. I want to display a
wait cursor when it starts, and hide the wait cursor when it has completed. This part works fairly well, using:

this.TopLevelControl.Cursor = System.Windows.Forms.Cursors.WaitCursor;

I also want to prevent user interaction with the controls on my form while
the wait cursor is displayed, so that use events (except resize and cancel) are blocked. What is the recommended way of doing this in .NET?

Thanks,
Aaron Queenan.

Nov 15 '05 #2

P: n/a
Unfortunately, it will also change the background colour to grey, does some
wierd colouring of ListView controls which have items in, and inconsistently
disables scrollbars depending upon where they are and who owns them. :-(

Is there any way I can disable the user interaction _without_ setting the
Enabled property to false?

Thanks,
Aaron.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:Ot**************@TK2MSFTNGP10.phx.gbl...
You can set the Enabled property of a control or even a form to false. This will prevent any user interaction.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Aaron Queenan" <aq*********************@contingent.com.au> schreef in
bericht news:Oh**************@TK2MSFTNGP12.phx.gbl...
I have a form which performs some asynchronous code. I want to display a wait cursor when it starts, and hide the wait cursor when it has

completed.
This part works fairly well, using:

this.TopLevelControl.Cursor = System.Windows.Forms.Cursors.WaitCursor;
I also want to prevent user interaction with the controls on my form while the wait cursor is displayed, so that use events (except resize and

cancel)
are blocked. What is the recommended way of doing this in .NET?

Thanks,
Aaron Queenan.


Nov 15 '05 #3

P: n/a
Aaron,

You could override WndProc, and just toss out most of the messages that
come into the window. Of course, you would have a property that would turn
on and shut off this behavior. You will probably want to still handle
WM_PAINT messages, at the least.

Hope this helps.

--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Aaron Queenan" <aq*********************@contingent.com.au> wrote in message
news:uH**************@TK2MSFTNGP10.phx.gbl...
Unfortunately, it will also change the background colour to grey, does some wierd colouring of ListView controls which have items in, and inconsistently disables scrollbars depending upon where they are and who owns them. :-(

Is there any way I can disable the user interaction _without_ setting the
Enabled property to false?

Thanks,
Aaron.

"Jan Tielens" <ja*@no.spam.please.leadit.be> wrote in message
news:Ot**************@TK2MSFTNGP10.phx.gbl...
You can set the Enabled property of a control or even a form to false. This
will prevent any user interaction.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Aaron Queenan" <aq*********************@contingent.com.au> schreef in
bericht news:Oh**************@TK2MSFTNGP12.phx.gbl...
I have a form which performs some asynchronous code. I want to
display a wait cursor when it starts, and hide the wait cursor when it has

completed.
This part works fairly well, using:

this.TopLevelControl.Cursor = System.Windows.Forms.Cursors.WaitCursor;
I also want to prevent user interaction with the controls on my form while the wait cursor is displayed, so that use events (except resize and

cancel)
are blocked. What is the recommended way of doing this in .NET?

Thanks,
Aaron Queenan.



Nov 15 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.