Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WaitCursor

WaitCursor

Scheduled Pinned Locked Moved C#
question
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    PaleyX
    wrote on last edited by
    #1

    I have a gui app which runs a long process on a worker thread. When the thread starts the long running process fires an event which is picked up by the gui thread and sets the Cursor.Current to the WaitCursor - when the long process has finished it fires another event and Cursor.Current is set to the default cursor. Unfortunately the cursor never becomes the WaitCursor - I can test the Cursor.Current.ToString() and it says it's the WaitCursor - but it isn't, just the default cursor. Why is that?

    U J 2 Replies Last reply
    0
    • P PaleyX

      I have a gui app which runs a long process on a worker thread. When the thread starts the long running process fires an event which is picked up by the gui thread and sets the Cursor.Current to the WaitCursor - when the long process has finished it fires another event and Cursor.Current is set to the default cursor. Unfortunately the cursor never becomes the WaitCursor - I can test the Cursor.Current.ToString() and it says it's the WaitCursor - but it isn't, just the default cursor. Why is that?

      U Offline
      U Offline
      Uwe Keim
      wrote on last edited by
      #2

      Maybe you need to call Application.DoEvents() [^] to actually dispatch the correct Windows messages to switch the cursor?!? -- Affordable Windows-based CMS: www.zeta-producer.com

      P 1 Reply Last reply
      0
      • U Uwe Keim

        Maybe you need to call Application.DoEvents() [^] to actually dispatch the correct Windows messages to switch the cursor?!? -- Affordable Windows-based CMS: www.zeta-producer.com

        P Offline
        P Offline
        PaleyX
        wrote on last edited by
        #3

        I tried doing that - it didn't do anything other than mess up the threads. Thanks for your reply though

        D 1 Reply Last reply
        0
        • P PaleyX

          I tried doing that - it didn't do anything other than mess up the threads. Thanks for your reply though

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #4

          If your GUI is truely idle, then you wouldn;t have to call DoEvents at all. But if you're GUI is doing something, like blocking while your waiting for a thread to complete, then DoEvents can do strange things. It sounds like you haven't done something correctly, but without further information and code samples, it's impossible to tell you what that is. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

          M 1 Reply Last reply
          0
          • P PaleyX

            I have a gui app which runs a long process on a worker thread. When the thread starts the long running process fires an event which is picked up by the gui thread and sets the Cursor.Current to the WaitCursor - when the long process has finished it fires another event and Cursor.Current is set to the default cursor. Unfortunately the cursor never becomes the WaitCursor - I can test the Cursor.Current.ToString() and it says it's the WaitCursor - but it isn't, just the default cursor. Why is that?

            J Offline
            J Offline
            Judah Gabriel Himango
            wrote on last edited by
            #5

            Are you sure the event is on the GUI thread? You might want to check using InvokeRequired property; if an invoke is required, that would explain why the cursor setting doesn't seem to be working.

            Tech, life, family, faith: Give me a visit. I'm currently blogging about: He has a funny face. And he's my son. Judah Himango

            M 1 Reply Last reply
            0
            • J Judah Gabriel Himango

              Are you sure the event is on the GUI thread? You might want to check using InvokeRequired property; if an invoke is required, that would explain why the cursor setting doesn't seem to be working.

              Tech, life, family, faith: Give me a visit. I'm currently blogging about: He has a funny face. And he's my son. Judah Himango

              M Offline
              M Offline
              maheshfour
              wrote on last edited by
              #6

              I HAVE A SIMILAR PROBLEM i am havig a list view and i dynamically tried to cange the cursor to waiting cursor, but it does not work. then i tried changing the cursor from the property of the list view but it does not work either.

              1 Reply Last reply
              0
              • D Dave Kreskowiak

                If your GUI is truely idle, then you wouldn;t have to call DoEvents at all. But if you're GUI is doing something, like blocking while your waiting for a thread to complete, then DoEvents can do strange things. It sounds like you haven't done something correctly, but without further information and code samples, it's impossible to tell you what that is. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                M Offline
                M Offline
                maheshfour
                wrote on last edited by
                #7

                I HAVE A SIMILAR PROBLEM i am havig a list view and i dynamically tried to cange the cursor to waiting cursor, but it does not work. then i tried changing the cursor from the property of the list view but it does not work either.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups