Repeat Question

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

    #1

    Repeat Question

    Hello,

    I am new to this news group. Please forgive me if this has been asked
    before.

    In my VB application, I have next and previous command buttons. I would
    like to be able to hold the left mouse button down on these buttons and have
    the operation repeat. Is this a property?

    adTHANKSvance,

    Stephen Saunders


  • J French

    #2
    Re: Repeat Question

    On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
    <kd6eut@earthli nk.net> wrote:
    [color=blue]
    >Hello,
    >
    >I am new to this news group. Please forgive me if this has been asked
    >before.
    >
    >In my VB application, I have next and previous command buttons. I would
    >like to be able to hold the left mouse button down on these buttons and have
    >the operation repeat. Is this a property?[/color]

    A Timer ?


    Comment

    • J French

      #3
      Re: Repeat Question

      On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
      <kd6eut@earthli nk.net> wrote:
      [color=blue]
      >Hello,
      >
      >I am new to this news group. Please forgive me if this has been asked
      >before.
      >
      >In my VB application, I have next and previous command buttons. I would
      >like to be able to hold the left mouse button down on these buttons and have
      >the operation repeat. Is this a property?[/color]

      A Timer ?


      Comment

      • J French

        #4
        Re: Repeat Question

        On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
        <kd6eut@earthli nk.net> wrote:
        [color=blue]
        >Hello,
        >
        >I am new to this news group. Please forgive me if this has been asked
        >before.
        >
        >In my VB application, I have next and previous command buttons. I would
        >like to be able to hold the left mouse button down on these buttons and have
        >the operation repeat. Is this a property?[/color]

        Oops - also you'll need to use the MouseDown and MouseUp events, and
        get rid of the Click

        I would wrap it in a UserControl (NOT OCXed) and call it something
        like a PulseButton

        Comment

        • J French

          #5
          Re: Repeat Question

          On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
          <kd6eut@earthli nk.net> wrote:
          [color=blue]
          >Hello,
          >
          >I am new to this news group. Please forgive me if this has been asked
          >before.
          >
          >In my VB application, I have next and previous command buttons. I would
          >like to be able to hold the left mouse button down on these buttons and have
          >the operation repeat. Is this a property?[/color]

          Oops - also you'll need to use the MouseDown and MouseUp events, and
          get rid of the Click

          I would wrap it in a UserControl (NOT OCXed) and call it something
          like a PulseButton

          Comment

          • Shell

            #6
            Re: Repeat Question

            In responce to the post:
            On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
            <kd6eut@earthli nk.net> stated...and I replied:
            [color=blue]
            >Hello,
            >
            >I am new to this news group. Please forgive me if this has been asked
            >before.
            >
            >In my VB application, I have next and previous command buttons. I would
            >like to be able to hold the left mouse button down on these buttons and have
            >the operation repeat. Is this a property?
            >
            >adTHANKSvanc e,
            >
            >Stephen Saunders
            >[/color]

            You may do better changing the 2 command buttons into a single
            horizontal scrollbar control. If you size it down so only the 2 (left
            & right) buttons show, it will look like 2 command buttons with left
            and right arrows.

            Just a thought,
            Shell
            -

            Into computers since 1972.
            WARNING! Information and e-mail addresses contained herein, are for personal use only. By entering this site, you agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via direct mail, electronic mail, or by telephone. Violators will be dealt with accordingly.
            -

            Comment

            • Shell

              #7
              Re: Repeat Question

              In responce to the post:
              On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
              <kd6eut@earthli nk.net> stated...and I replied:
              [color=blue]
              >Hello,
              >
              >I am new to this news group. Please forgive me if this has been asked
              >before.
              >
              >In my VB application, I have next and previous command buttons. I would
              >like to be able to hold the left mouse button down on these buttons and have
              >the operation repeat. Is this a property?
              >
              >adTHANKSvanc e,
              >
              >Stephen Saunders
              >[/color]

              You may do better changing the 2 command buttons into a single
              horizontal scrollbar control. If you size it down so only the 2 (left
              & right) buttons show, it will look like 2 command buttons with left
              and right arrows.

              Just a thought,
              Shell
              -

              Into computers since 1972.
              WARNING! Information and e-mail addresses contained herein, are for personal use only. By entering this site, you agree that you will use this data only for lawful purposes and that, under no circumstances will you use this data to: allow, enable, or otherwise support the transmission of mass unsolicited, commercial advertising or solicitations via direct mail, electronic mail, or by telephone. Violators will be dealt with accordingly.
              -

              Comment

              • five of nothing

                #8
                Re: Repeat Question

                What J French is saying is to do something like the following:
                Add a timer for each button, say TmrNext and TmrPrev. Set their
                interval property to the repeat time (how often does it repeat the
                click), in milliseconds.
                Then, instead of a CmdNext_Click event that looks like this:
                Sub CmdNext_Click()
                [do stuff]
                End Sub

                Make a CmdNext_MouseDo wn event that looks like this:
                Sub CmdNext_MouseDo wn()
                TmrNext_Timer()
                TmrNext.Enabled = True
                End Sub

                And put the [do stuff] in the TmrNext_Timer() event:
                Sub TmrNext_Timer()
                [do stuff]
                End Sub

                Finally, add a CmdNext_MouseUp () event to disable the timer:
                Sub CmdNext_MouseUp ()
                TmrNext.Enabled = False
                End Sub

                That way, when the user presses the button, it will set off the
                MouseDown event. This will first run the TmrNext_Timer() event, which
                just does the [do stuff]. Then it will set the timer ticking. Then
                every time the timer goes off, it'll do the [do stuff] again. When
                they let go of the button, CmdNext_MouseUp (), the timer will be
                stopped, so [do stuff] won't happen again.

                You would, of course, do the same for CmdPrev. And because all this is
                a lot to do twice and would be useful, wrapping it in a UserControl
                would be helpful, but not necessary.

                The only problem with this plan that I see is that if they clicked and
                then dragged off the button to let go (Triggering MouseDown but not
                MouseUp), the [do stuff] would keep happening until they clicked the
                button again (Triggering MouseDown _and_ MouseUp). But this problem is
                easily worked around (click the button again).

                Comment

                • five of nothing

                  #9
                  Re: Repeat Question

                  What J French is saying is to do something like the following:
                  Add a timer for each button, say TmrNext and TmrPrev. Set their
                  interval property to the repeat time (how often does it repeat the
                  click), in milliseconds.
                  Then, instead of a CmdNext_Click event that looks like this:
                  Sub CmdNext_Click()
                  [do stuff]
                  End Sub

                  Make a CmdNext_MouseDo wn event that looks like this:
                  Sub CmdNext_MouseDo wn()
                  TmrNext_Timer()
                  TmrNext.Enabled = True
                  End Sub

                  And put the [do stuff] in the TmrNext_Timer() event:
                  Sub TmrNext_Timer()
                  [do stuff]
                  End Sub

                  Finally, add a CmdNext_MouseUp () event to disable the timer:
                  Sub CmdNext_MouseUp ()
                  TmrNext.Enabled = False
                  End Sub

                  That way, when the user presses the button, it will set off the
                  MouseDown event. This will first run the TmrNext_Timer() event, which
                  just does the [do stuff]. Then it will set the timer ticking. Then
                  every time the timer goes off, it'll do the [do stuff] again. When
                  they let go of the button, CmdNext_MouseUp (), the timer will be
                  stopped, so [do stuff] won't happen again.

                  You would, of course, do the same for CmdPrev. And because all this is
                  a lot to do twice and would be useful, wrapping it in a UserControl
                  would be helpful, but not necessary.

                  The only problem with this plan that I see is that if they clicked and
                  then dragged off the button to let go (Triggering MouseDown but not
                  MouseUp), the [do stuff] would keep happening until they clicked the
                  button again (Triggering MouseDown _and_ MouseUp). But this problem is
                  easily worked around (click the button again).

                  Comment

                  • Steve Gerrard

                    #10
                    Re: Repeat Question


                    "five of nothing" <50gg@mailinato r.com> wrote in message
                    news:1109971665 .675338.280860@ l41g2000cwc.goo glegroups.com.. .[color=blue]
                    > The only problem with this plan that I see is that if they clicked and
                    > then dragged off the button to let go (Triggering MouseDown but not
                    > MouseUp), the [do stuff] would keep happening until they clicked the
                    > button again (Triggering MouseDown _and_ MouseUp). But this problem is
                    > easily worked around (click the button again).
                    >[/color]

                    Actually that is not a problem. Even if they drag away from the command button,
                    it will still receive the MouseUp event when the user releases the button. The X
                    and Y values will just be outside the boundaries of the command button.


                    Comment

                    • Steve Gerrard

                      #11
                      Re: Repeat Question


                      "five of nothing" <50gg@mailinato r.com> wrote in message
                      news:1109971665 .675338.280860@ l41g2000cwc.goo glegroups.com.. .[color=blue]
                      > The only problem with this plan that I see is that if they clicked and
                      > then dragged off the button to let go (Triggering MouseDown but not
                      > MouseUp), the [do stuff] would keep happening until they clicked the
                      > button again (Triggering MouseDown _and_ MouseUp). But this problem is
                      > easily worked around (click the button again).
                      >[/color]

                      Actually that is not a problem. Even if they drag away from the command button,
                      it will still receive the MouseUp event when the user releases the button. The X
                      and Y values will just be outside the boundaries of the command button.


                      Comment

                      • Martin

                        #12
                        Re: Repeat Question

                        I tried out the advice given and came up with this as an example:-

                        Add a timer to your form (say Timer1) add a command button to the form (say
                        Button1) - Set its Enabled Property to False - Set its Interval Property to
                        100.

                        Then:-

                        Private Sub command1_MouseD own(button As Integer, shift As Integer, x As
                        Single, y As Single)
                        timer1_timer
                        Timer1.Enabled = True
                        End Sub

                        Sub timer1_timer()
                        Print "In"
                        End Sub

                        Private Sub command1_Mouseu p(button As Integer, shift As Integer, x As
                        Single, y As Single)
                        Timer1.Enabled = False
                        Print "Out"
                        End Sub

                        Thanks Group

                        Martin

                        "Stephen Saunders" <kd6eut@earthli nk.net> wrote in message
                        news:w3XVd.879$ 603.72@newsread 2.news.atl.eart hlink.net...[color=blue]
                        > Hello,
                        >
                        > I am new to this news group. Please forgive me if this has been asked
                        > before.
                        >
                        > In my VB application, I have next and previous command buttons. I would
                        > like to be able to hold the left mouse button down on these buttons and[/color]
                        have[color=blue]
                        > the operation repeat. Is this a property?
                        >
                        > adTHANKSvance,
                        >
                        > Stephen Saunders
                        >
                        >[/color]


                        Comment

                        • Martin

                          #13
                          Re: Repeat Question

                          I tried out the advice given and came up with this as an example:-

                          Add a timer to your form (say Timer1) add a command button to the form (say
                          Button1) - Set its Enabled Property to False - Set its Interval Property to
                          100.

                          Then:-

                          Private Sub command1_MouseD own(button As Integer, shift As Integer, x As
                          Single, y As Single)
                          timer1_timer
                          Timer1.Enabled = True
                          End Sub

                          Sub timer1_timer()
                          Print "In"
                          End Sub

                          Private Sub command1_Mouseu p(button As Integer, shift As Integer, x As
                          Single, y As Single)
                          Timer1.Enabled = False
                          Print "Out"
                          End Sub

                          Thanks Group

                          Martin

                          "Stephen Saunders" <kd6eut@earthli nk.net> wrote in message
                          news:w3XVd.879$ 603.72@newsread 2.news.atl.eart hlink.net...[color=blue]
                          > Hello,
                          >
                          > I am new to this news group. Please forgive me if this has been asked
                          > before.
                          >
                          > In my VB application, I have next and previous command buttons. I would
                          > like to be able to hold the left mouse button down on these buttons and[/color]
                          have[color=blue]
                          > the operation repeat. Is this a property?
                          >
                          > adTHANKSvance,
                          >
                          > Stephen Saunders
                          >
                          >[/color]


                          Comment

                          • five of nothing

                            #14
                            Re: Repeat Question

                            So I presume it worked?

                            Comment

                            • five of nothing

                              #15
                              Re: Repeat Question

                              So I presume it worked?

                              Comment

                              Working...