Mouse Pointer Cursor and textbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • DotNetShadow

    Mouse Pointer Cursor and textbox

    Hi Guys,

    I have been having this problem recently where I have a form with a
    textbox and button, if in the button event I have the following:

    Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
    System.EventArg s) Handles Button1.Click
    Me.Cursor = Cursors.WaitCur sor
    Textbox1.text = Now.Tostring
    System.Threadin g.Thread.Sleep( 2000) ' 2 second wait
    Me.Cursor = Cursors.Arrow
    End Sub

    If I click the button the mouse cursor changes to an hourglass,
    updates the textbox with current time and after 2 seconds the mouse
    cursor returns back to the arrow The problem lies that when u click
    the mouse button repeatedly even though the mouse cursor changes to an
    hourglass the button is still clickable furthermore u can type text in
    the textbox.

    Is this the default behaviour of .NET? Is this a bug? I have even
    tried disabling form elements and changing the cursor of these form
    elements to hourlgass with no success can someone please help thanks

    Regards DotNetShadow
  • Armin Zingler

    #2
    Re: Mouse Pointer Cursor and textbox

    "DotNetShad ow" <roberto3214@ne tscape.net> schrieb[color=blue]
    > If I click the button the mouse cursor changes to an hourglass,
    > updates the textbox with current time and after 2 seconds the
    > mouse cursor returns back to the arrow The problem lies that when u
    > click the mouse button repeatedly even though the mouse cursor
    > changes to an hourglass the button is still clickable furthermore u
    > can type text in the textbox.
    >
    > Is this the default behaviour of .NET?[/color]

    This is the default behavior of Windows. Mouse and keyboard interaction and
    other events have always been queued. Even in DOS there was a keyboard
    buffer queueing the keyboard input.


    --
    Armin




    Comment

    • Cor

      #3
      Re: Mouse Pointer Cursor and textbox

      Hi Roberto,

      A question like this has been yesterday also in this newsgroup

      the answer is make the textbox1.enable d = false

      I hope this helps?

      Cor[color=blue]
      > I have been having this problem recently where I have a form with a
      > textbox and button, if in the button event I have the following:
      >
      > Private Sub Button1_Click(B yVal sender As System.Object, ByVal e As
      > System.EventArg s) Handles Button1.Click
      > Me.Cursor = Cursors.WaitCur sor
      > Textbox1.text = Now.Tostring
      > System.Threadin g.Thread.Sleep( 2000) ' 2 second wait
      > Me.Cursor = Cursors.Arrow
      > End Sub
      >
      > If I click the button the mouse cursor changes to an hourglass,
      > updates the textbox with current time and after 2 seconds the mouse
      > cursor returns back to the arrow The problem lies that when u click
      > the mouse button repeatedly even though the mouse cursor changes to an
      > hourglass the button is still clickable furthermore u can type text in
      > the textbox.
      >
      > Is this the default behaviour of .NET? Is this a bug? I have even
      > tried disabling form elements and changing the cursor of these form
      > elements to hourlgass with no success can someone please help thanks
      >[/color]


      Comment

      • Armin Zingler

        #4
        Re: Mouse Pointer Cursor and textbox

        "Cor" <non@non.com> schrieb[color=blue]
        > A question like this has been yesterday also in this newsgroup
        >
        > the answer is make the textbox1.enable d = false[/color]

        I think you mean button1.enabled = false, but, this wouldn't help also. The
        mouse clicks will be processed after the button has been enabled again.


        --
        Armin




        Comment

        • Cor

          #5
          Re: Mouse Pointer Cursor and textbox

          Hi Armin,

          I saw your answer, and please see my message about what I thought it was a
          bug but you say normal behaviour.

          Now I know that this behaviour is known, I did not know it, but I find it
          weird, no user will understand it.

          Thanks anyway

          Cor
          [color=blue][color=green]
          > > A question like this has been yesterday also in this newsgroup
          > >
          > > the answer is make the textbox1.enable d = false[/color]
          >
          > I think you mean button1.enabled = false, but, this wouldn't help also.[/color]
          The[color=blue]
          > mouse clicks will be processed after the button has been enabled again.
          >
          >
          > --
          > Armin
          >
          > http://www.plig.net/nnq/nquote.html
          > http://www.netmeister.org/news/learn2quote.html
          >[/color]


          Comment

          • DotNetShadow

            #6
            Re: Mouse Pointer Cursor and textbox

            Thanks for all your replies guys, just afew follow up questions:

            1) So if this is the default behaviour for windows in vb6 apps would
            the same problem occur?

            2) How do you get around the problem? Disabling a form element will
            not help since after the event occurs the mouse messages continue so
            how do you cancel them?

            3) Can sample code be posted to solve this problem?


            Regards DotNetShadow

            "Cor" <non@non.com> wrote in message news:<uxDtKeq2D HA.716@TK2MSFTN GP12.phx.gbl>.. .[color=blue]
            > Hi Armin,
            >
            > I saw your answer, and please see my message about what I thought it was a
            > bug but you say normal behaviour.
            >
            > Now I know that this behaviour is known, I did not know it, but I find it
            > weird, no user will understand it.
            >
            > Thanks anyway
            >
            > Cor
            >[color=green][color=darkred]
            > > > A question like this has been yesterday also in this newsgroup
            > > >
            > > > the answer is make the textbox1.enable d = false[/color]
            > >
            > > I think you mean button1.enabled = false, but, this wouldn't help also.[/color]
            > The[color=green]
            > > mouse clicks will be processed after the button has been enabled again.
            > >
            > >
            > > --
            > > Armin
            > >
            > > http://www.plig.net/nnq/nquote.html
            > > http://www.netmeister.org/news/learn2quote.html
            > >[/color][/color]

            Comment

            • Armin Zingler

              #7
              Re: Mouse Pointer Cursor and textbox

              "DotNetShad ow" <roberto3214@ne tscape.net> schrieb[color=blue]
              > Thanks for all your replies guys, just afew follow up questions:
              >
              > 1) So if this is the default behaviour for windows in vb6 apps
              > would the same problem occur?[/color]

              yes
              [color=blue]
              > 2) How do you get around the problem? Disabling a form element
              > will not help since after the event occurs the mouse messages
              > continue so how do you cancel them?
              >
              > 3) Can sample code be posted to solve this problem?[/color]

              Put the work in a different thread. Your UI thread will stay responsive. In
              this thread, I usually show a modal Form showing the current process and the
              progress (if possible). The Form also contains a cancel button.

              --
              Armin




              Comment

              • Cor

                #8
                Re: Mouse Pointer Cursor and textbox

                Hi Armin,

                If you see the test I did in this newsgroup with my question if it is bug.

                I could not get the unwised behaviour when I disabled the textbox instead of
                making it read only.

                I was thinking on that later, maybe you can try it.

                Cor


                Comment

                • Herfried K. Wagner [MVP]

                  #9
                  Re: Mouse Pointer Cursor and textbox

                  * "Armin Zingler" <az.nospam@free net.de> scripsit:[color=blue][color=green]
                  >> 2) How do you get around the problem? Disabling a form element
                  >> will not help since after the event occurs the mouse messages
                  >> continue so how do you cancel them?
                  >>
                  >> 3) Can sample code be posted to solve this problem?[/color]
                  >
                  > Put the work in a different thread. Your UI thread will stay responsive. In
                  > this thread, I usually show a modal Form showing the current process and the
                  > progress (if possible). The Form also contains a cancel button.[/color]

                  Something like that (C#):

                  <http://www.codeproject .com/cs/miscctrl/progressdialog. asp>

                  --
                  Herfried K. Wagner [MVP]
                  <http://www.mvps.org/dotnet>

                  Comment

                  • Armin Zingler

                    #10
                    Re: Mouse Pointer Cursor and textbox

                    "Cor" <non@non.com> schrieb[color=blue]
                    >
                    > If you see the test I did in this newsgroup with my question if it is
                    > bug.[/color]

                    I thought I've already answered in the other thread. Now I looked again and
                    saw that my reply was still in the templates folder = not sent yet. I didn't
                    send it because I was unsure about the "message of your message". Well, I've
                    sent it now but it doesn't contain much, so.....
                    [color=blue]
                    > I could not get the unwised behaviour when I disabled the textbox
                    > instead of making it read only.[/color]
                    [color=blue]
                    >
                    > I was thinking on that later, maybe you can try it.[/color]

                    I'll have a look.


                    --
                    Armin




                    Comment

                    Working...