469,898 Members | 1,597 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,898 developers. It's quick & easy.

automaticly change mouse pointer into hourglass

Is it posible to set something so that when my vb.net (visual studio 2005,
framework 2.0) application is busy that the mouse pointer change into a
hourglass ?

Or do i have to set everywhere where my application do something
Windows.Forms.Cursor.Current = Cursors.WaitCursor ??

something is for example calling the sql-server database to get/set data

please help me
Oct 2 '06 #1
6 13584
Is it posible to set something so that when my vb.net (visual studio 2005,
framework 2.0) application is busy that the mouse pointer change into a
hourglass ?

Or do i have to set everywhere where my application do something
Windows.Forms.Cursor.Current = Cursors.WaitCursor ??

something is for example calling the sql-server database to get/set data
Well, you don't want to set WaitCursor at all times when your 'application
is busy'. Your app gets busy at Window's discretion more often than you
realize. However, you could probably detect busy status via
Application.AddMessageFilter. I advise against it.

What you could do is to set WaitCursor at the places where your app gets
'significantly' busy, and set CursorNormal in an Application.Idle event
handler. I would bookkeep your app's cursor status in a global variable so
that you can no-op attempts to set it to busy when it is already busy (or to
normal when it is already normal). You might want to set the cursor for all
forms in your app at the same time. All this suggests a sub whose calling
sequence takes a boolean busy-notbusy parameter.
Oct 2 '06 #2

"AMercer" wrote:
Is it posible to set something so that when my vb.net (visual studio 2005,
framework 2.0) application is busy that the mouse pointer change into a
hourglass ?

Or do i have to set everywhere where my application do something
Windows.Forms.Cursor.Current = Cursors.WaitCursor ??

something is for example calling the sql-server database to get/set data

Well, you don't want to set WaitCursor at all times when your 'application
is busy'. Your app gets busy at Window's discretion more often than you
realize. However, you could probably detect busy status via
Application.AddMessageFilter. I advise against it.

What you could do is to set WaitCursor at the places where your app gets
'significantly' busy, and set CursorNormal in an Application.Idle event
handler. I would bookkeep your app's cursor status in a global variable so
that you can no-op attempts to set it to busy when it is already busy (or to
normal when it is already normal). You might want to set the cursor for all
forms in your app at the same time. All this suggests a sub whose calling
sequence takes a boolean busy-notbusy parameter.
Is there an other (easier) way to show an user that the application is busy
at the time ?
for example when I ask information at the database the sql server is serval
seconds busy to retrief all the data and display it to the user. I want to
make clear to the user that the application is busy at the time. so what is
the best way to do this ?

Jan
Oct 2 '06 #3
Is there an other (easier) way to show an user that the application is busy
at the time ?
for example when I ask information at the database the sql server is serval
seconds busy to retrief all the data and display it to the user. I want to
make clear to the user that the application is busy at the time. so what is
the best way to do this ?
In my opinion, WaitCursor is the best way. It is also the conventional way
in windows. You could make something up (eg a color change to your form(s)),
but it would take some effort, so my guess is that WaitCursor is the easiest
way as well.

Oct 2 '06 #4
Jan Heppen wrote:
"AMercer" wrote:
Is there an other (easier) way to show an user that the application is busy
at the time ?
for example when I ask information at the database the sql server is serval
seconds busy to retrief all the data and display it to the user. I want to
make clear to the user that the application is busy at the time. so what is
the best way to do this ?

Jan
We usually popup a borderless window with a message like "Please wait,
retrieving data" or something to that effect.

--
Rinze van Huizen
C-Services Holland b.v
Oct 3 '06 #5
Is there an other (easier) way to show an user that the application is
busy
at the time ?
for example when I ask information at the database the sql server is serval
seconds busy to retrief all the data and display it to the user. I want to
make clear to the user that the application is busy at the time. so what is
the best way to do this ?

In my opinion, WaitCursor is the best way. It is also the conventional way
in windows. You could make something up (eg a color change to your form(s)),
but it would take some effort, so my guess is that WaitCursor is the easiest
way as well.
Is it correct that when I think the client could be busy and I call the
function WaitCursor that it automaticly comes back to the "normal arrow
state" or is the WaitCursor still active at the background ?

I tried somethings but when the client is ready and is back in the "normal
arrow state" I don't get the WaitCursor state. Unless I call it again. So it
seems that I only have to call WaitCursor when I think the client could be
busy and Windows does the rest and sets the cursor back to normal when the
data is retrieved.
Oct 4 '06 #6
Is it correct that when I think the client could be busy and I call the
function WaitCursor that it automaticly comes back to the "normal arrow
state" or is the WaitCursor still active at the background ?

I tried somethings but when the client is ready and is back in the "normal
arrow state" I don't get the WaitCursor state. Unless I call it again. So it
seems that I only have to call WaitCursor when I think the client could be
busy and Windows does the rest and sets the cursor back to normal when the
data is retrieved.
I set the control's .Cursor property, and I don't mess with the .Current
property, so I am on unfamiliar ground. The documentation says that if you
change .Current, and the call DoEvents, the .Current property will be
restored:

"All controls that derive from the Control class have a Cursor property. To
change the cursor displayed by the mouse pointer when it is within the bounds
of the control, assign a Cursor to the Cursor property of the control.
Alternatively, you can display cursors at the application level by assigning
a Cursor to the Current property. For example, if the purpose of your
application is to edit a text file, you might set the Current property to
Cursors.WaitCursor to display a wait cursor over the application while the
file loads or saves to prevent any mouse events from being processed. When
the process is complete, set the Current property to Cursors.Default for the
application to display the appropriate cursor over each control type.

Note If you call Application.DoEvents before resetting the Current
property back to the Cursors.Default cursor, the application will resume
listening for mouse events and will resume displaying the appropriate Cursor
for each control in the application."

Oct 6 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by KarenP | last post: by
9 posts views Thread by DotNetShadow | last post: by
2 posts views Thread by diatom | last post: by
reply views Thread by Salome Sato | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.