ignoring mouse clicks

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

    #1

    ignoring mouse clicks

    Currently, when my application needs to write/read to a
    database, there is a time lag. In that time lag, a user
    can click the same button multiple times causing my app
    problems. I want to turn the mouse pointer arrow into an
    hourglass and ignore mouse clicks until my app finishes
    working. Most commercial apps I've looked at do this.
    Is there an easy way to do this (ie. any built-in
    controls in VS.NET or classes in MSDN)? Any suggestions
    and/or code samples would be greatly appreciated. Thank
    you for the reply.

    Mike
  • William Ryan

    #2
    Re: ignoring mouse clicks

    A lot of times that behavior is because of single threading and the app is
    simply waiting for the next line to complete. You could set the button's
    enabled to false and then when the proc is done, set it back to true or wait
    for whatever event to occur to tell it to be enabled.

    You coudl do the similar thing by setting a bool and once the button is
    clicked for the first time, set it to false. On the same click event, if
    not myBool Exit Sub.
    "Mike" <mikebiros@hotm ail.com> wrote in message
    news:0aa701c377 03$5f718bf0$a00 1280a@phx.gbl.. .[color=blue]
    > Currently, when my application needs to write/read to a
    > database, there is a time lag. In that time lag, a user
    > can click the same button multiple times causing my app
    > problems. I want to turn the mouse pointer arrow into an
    > hourglass and ignore mouse clicks until my app finishes
    > working. Most commercial apps I've looked at do this.
    > Is there an easy way to do this (ie. any built-in
    > controls in VS.NET or classes in MSDN)? Any suggestions
    > and/or code samples would be greatly appreciated. Thank
    > you for the reply.
    >
    > Mike[/color]


    Comment

    • Alex Bendig

      #3
      Re: ignoring mouse clicks

      Mike,

      Something along these lines:
      -------------
      Cursor = Cursors.WaitCur sor;
      // ... do processing
      Cursor = Cursors.Arrow;
      -------------

      Is this what you were looking for?

      Regards,
      Alex


      "Mike" <mikebiros@hotm ail.com> wrote in message
      news:0aa701c377 03$5f718bf0$a00 1280a@phx.gbl.. .[color=blue]
      > Currently, when my application needs to write/read to a
      > database, there is a time lag. In that time lag, a user
      > can click the same button multiple times causing my app
      > problems. I want to turn the mouse pointer arrow into an
      > hourglass and ignore mouse clicks until my app finishes
      > working. Most commercial apps I've looked at do this.
      > Is there an easy way to do this (ie. any built-in
      > controls in VS.NET or classes in MSDN)? Any suggestions
      > and/or code samples would be greatly appreciated. Thank
      > you for the reply.
      >
      > Mike[/color]


      Comment

      • NULL

        #4
        Re: ignoring mouse clicks

        On Tue, 9 Sep 2003 11:51:26 -0700, "Mike" <mikebiros@hotm ail.com>
        wrote:
        [color=blue]
        >Currently, when my application needs to write/read to a
        >database, there is a time lag. In that time lag, a user
        >can click the same button multiple times causing my app
        >problems. I want to turn the mouse pointer arrow into an
        >hourglass and ignore mouse clicks until my app finishes
        >working. Most commercial apps I've looked at do this.
        >Is there an easy way to do this (ie. any built-in
        >controls in VS.NET or classes in MSDN)? Any suggestions
        >and/or code samples would be greatly appreciated. Thank
        >you for the reply.[/color]


        when using C#, you could use teh -= operator on the Click-event (and
        += to re-subscribe after the processing)

        --
        NULL

        Comment

        • Mike

          #5
          Re: ignoring mouse clicks

          That is exactly what I am looking for. Just one thing,
          after I turn the cursor into a wait cursor, is there a
          way to disable all the controls (e.g buttons, textboxes)
          so that I can't click on anything, or do I have to
          disable each control individually. Again , thanks for
          the reply.
          [color=blue]
          >-----Original Message-----
          >Mike,
          >
          >Something along these lines:
          >-------------
          >Cursor = Cursors.WaitCur sor;
          >// ... do processing
          >Cursor = Cursors.Arrow;
          >-------------
          >
          >Is this what you were looking for?
          >
          >Regards,
          >Alex
          >
          >
          >"Mike" <mikebiros@hotm ail.com> wrote in message
          >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..[color=green]
          >> Currently, when my application needs to write/read to a
          >> database, there is a time lag. In that time lag, a[/color][/color]
          user[color=blue][color=green]
          >> can click the same button multiple times causing my app
          >> problems. I want to turn the mouse pointer arrow into[/color][/color]
          an[color=blue][color=green]
          >> hourglass and ignore mouse clicks until my app finishes
          >> working. Most commercial apps I've looked at do this.
          >> Is there an easy way to do this (ie. any built-in
          >> controls in VS.NET or classes in MSDN)? Any[/color][/color]
          suggestions[color=blue][color=green]
          >> and/or code samples would be greatly appreciated.[/color][/color]
          Thank[color=blue][color=green]
          >> you for the reply.
          >>
          >> Mike[/color]
          >
          >
          >.
          >[/color]

          Comment

          • Horatiu Ripa

            #6
            Re: ignoring mouse clicks

            this.Enabled = false;

            --
            Horatiu Ripa
            Software Development Manager
            Business Logic Systems LTD
            21 Victor Babes str., 1st floor, 3400 Cluj-Napoca, Romania
            Phone/Fax: +40 264 590703
            Web: www.businesslogic.co.uk

            This email (email message and any attachments) is strictly confidential,
            possibly privileged and is intended solely for the person or organization to
            whom it is addressed. If you are not the intended recipient, you must not
            copy, distribute or take any action in reliance on it. If you have received
            this email in error, please inform the sender immediately before deleting
            it. Business Logic Systems Ltd accepts no responsibility for any advice,
            opinion, conclusion or other information contained in this email or arising
            from its disclosure.

            "Mike" <mikebiros@hotm ail.com> wrote in message
            news:5def01c377 53$26bce390$a50 1280a@phx.gbl.. .[color=blue]
            > That is exactly what I am looking for. Just one thing,
            > after I turn the cursor into a wait cursor, is there a
            > way to disable all the controls (e.g buttons, textboxes)
            > so that I can't click on anything, or do I have to
            > disable each control individually. Again , thanks for
            > the reply.
            >[color=green]
            > >-----Original Message-----
            > >Mike,
            > >
            > >Something along these lines:
            > >-------------
            > >Cursor = Cursors.WaitCur sor;
            > >// ... do processing
            > >Cursor = Cursors.Arrow;
            > >-------------
            > >
            > >Is this what you were looking for?
            > >
            > >Regards,
            > >Alex
            > >
            > >
            > >"Mike" <mikebiros@hotm ail.com> wrote in message
            > >news:0aa701c37 703$5f718bf0$a0 01280a@phx.gbl. ..[color=darkred]
            > >> Currently, when my application needs to write/read to a
            > >> database, there is a time lag. In that time lag, a[/color][/color]
            > user[color=green][color=darkred]
            > >> can click the same button multiple times causing my app
            > >> problems. I want to turn the mouse pointer arrow into[/color][/color]
            > an[color=green][color=darkred]
            > >> hourglass and ignore mouse clicks until my app finishes
            > >> working. Most commercial apps I've looked at do this.
            > >> Is there an easy way to do this (ie. any built-in
            > >> controls in VS.NET or classes in MSDN)? Any[/color][/color]
            > suggestions[color=green][color=darkred]
            > >> and/or code samples would be greatly appreciated.[/color][/color]
            > Thank[color=green][color=darkred]
            > >> you for the reply.
            > >>
            > >> Mike[/color]
            > >
            > >
            > >.
            > >[/color][/color]


            Comment

            Working...