PC Review


Reply
Thread Tools Rate Thread

Cursor.Current

 
 
Armin Zingler
Guest
Posts: n/a
 
      8th Aug 2003
Hello,

is it right that the cursor is *always* set back to it's default when the
application is idle?

cursor.current = cursors.waitcursor
'code taking some seconds
'after that the application is idle


Do I have to write
cursor.current = cursors.default
after the code above? Or even

dim c as cursor
c = cursor.current
cursor.current = cursors.waitcursor
'code taking some seconds
cursor.current = c

?

Thanks in advance


--
Armin

 
Reply With Quote
 
 
 
 
Dmitriy Lapshin [C# / .NET MVP]
Guest
Posts: n/a
 
      8th Aug 2003
Hello Armin,

I would recommend always resetting the cursor shape to its default value
manually, preferrably in a finally block to ensure that the cursor is reset
to Default even when an exception is raised.

--
Dmitriy Lapshin [C# / .NET MVP]
X-Unity Unit Testing and Integration Environment
http://x-unity.miik.com.ua
Deliver reliable .NET software

"Armin Zingler" <(E-Mail Removed)> wrote in message
news:3f33ad46$0$30083$(E-Mail Removed)...
> Hello,
>
> is it right that the cursor is *always* set back to it's default when the
> application is idle?
>
> cursor.current = cursors.waitcursor
> 'code taking some seconds
> 'after that the application is idle
>
>
> Do I have to write
> cursor.current = cursors.default
> after the code above? Or even
>
> dim c as cursor
> c = cursor.current
> cursor.current = cursors.waitcursor
> 'code taking some seconds
> cursor.current = c
>
> ?
>
> Thanks in advance
>
>
> --
> Armin
>


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      8th Aug 2003
"Herfried K. Wagner [MVP]" <(E-Mail Removed)> schrieb
> Hello,
>
> "Armin Zingler" <(E-Mail Removed)> schrieb:
> > is it right that the cursor is *always* set back to it's
> > default when the application is idle?

>
>

http://msdn.microsoft.com/library/en...rrenttopic.asp

You probably know that I know this topic but it doesn't answer my question.

I asked because setting it to the default cursor afterwards might be wrong
because it is possible that before setting it to Cursors.Hourglass, it has
not been the default cursor (e.g. AppStarting).


--
Armin

 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      8th Aug 2003
"Armin Zingler" <(E-Mail Removed)> schrieb
> "Herfried K. Wagner [MVP]" <(E-Mail Removed)> schrieb
> > Hello,
> >
> > "Armin Zingler" <(E-Mail Removed)> schrieb:
> > > is it right that the cursor is *always* set back to it's
> > > default when the application is idle?

> >
> >

>

http://msdn.microsoft.com/library/en...rrenttopic.asp
>
> You probably know that I know this topic but it doesn't answer my
> question.
>
> I asked because setting it to the default cursor afterwards might be
> wrong because it is possible that before setting it to
> Cursors.Hourglass, it has not been the default cursor (e.g.
> AppStarting).


One thing to add, and why I was a little confused:
Set a Form's cursor property to AppStarting. Add a button to the form. In
the Button_Click event handler add this code:

Cursor.Current = Cursors.WaitCursor
Cursor.Current = Cursors.Default

Start and click the button => the cursor is restored to AppStarting (as
expected).

Stop the app, and add a timer (Winforms Timer, interval=5000, enabled=true).
Add the same two lines in the timer's tick event handler. Start again, move
the mouse so that it is located over the form. Don't move it anymore! Wait
til the tick event fires => The cursor is *not* restored.

So, there is a difference between setting "Cursor.Current = Cursors.Default"
in a Button's click event and a Timer's tick event. I don't know why.

--
Armin

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to keep cursor in the current page? Scott M. Microsoft ASP .NET 2 2nd Sep 2009 01:15 PM
Re: How to keep cursor in the current page? William Niver Microsoft ASP .NET 0 1st Sep 2009 05:38 PM
Cursor.Current bug? Chris Shepherd Microsoft C# .NET 1 13th Sep 2007 03:38 PM
this.Cursor works but not Cursor.Current not working =?Utf-8?B?Sm9hY2hpbQ==?= Microsoft C# .NET 4 18th Apr 2007 04:12 PM
Attachment under the current cursor? Dennis Brown Microsoft Outlook VBA Programming 1 14th Aug 2005 01:18 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:46 AM.