473,386 Members | 1,708 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Preventing user interaction while showing a "wait" cursor

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
3 4100
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: metsymani | last post by:
In my web application, I have a search screen coded in ASP.Net. The Search process takes lot of time. So, I need to show a wait page informing the user that "Search is in progress. Please wait" along...
4
by: Marty Cruise | last post by:
Does anyone know of an wait-type cursor that can show text beside the hourglass? I'd like to display status messages beside the hourglass while not allowing the user to click anything...
12
by: info | last post by:
Hi All, I am trying to set the hourglass cursor inside a class that has nothing to do with MainForm class and I don't want to pass a reference to MainForm. How can I set the current cursor to...
4
by: louvino | last post by:
Hi, I have some links. When I click on one, a window opens but during the loading of this window, I would like the cursor is in state "wait" (using CSS : cursor : wait; ) Help me :-)
5
by: Jeremy | last post by:
Hi all, I have database actions that will potentially take several seconds to complete. My normal page uses AJAX so keeping the user informed of what is happening is not a problem. ...
1
by: DKn | last post by:
Hi all, I am doing one c#.Net windows application. I am having one user Control. On button click When the process is going on, i made this.cursor = Cursors.WaitCursor; Wait cursor is coming but...
2
by: DKn | last post by:
Hello All, I am doing one C#.net windows application. At the time of loading the form , some operations need to be done, so it will take time( one or two minutes) to load the form. At this time,...
1
by: =?Utf-8?B?Sm9obiBXYWxrZXI=?= | last post by:
Hi, I have a webpage designed with asp.net 2.0. Is there a way to display a "please wait" message to the screen horizontally centered and veritcally 20px from the VISIBLE top of the page,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.