468,242 Members | 1,710 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,242 developers. It's quick & easy.

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
Jul 17 '05 #1
16 5063
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> wrote:
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?


A Timer ?
Jul 17 '05 #2
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> wrote:
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?


A Timer ?
Jul 17 '05 #3
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> wrote:
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?


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
Jul 17 '05 #4
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> wrote:
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?


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
Jul 17 '05 #5
In responce to the post:
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> stated...and I replied:
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


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
-
http://drshell.home.mindspring.com/
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.
-
Jul 17 '05 #6
In responce to the post:
On Fri, 04 Mar 2005 10:50:04 GMT, "Stephen Saunders"
<kd****@earthlink.net> stated...and I replied:
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


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
-
http://drshell.home.mindspring.com/
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.
-
Jul 17 '05 #7
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_MouseDown event that looks like this:
Sub CmdNext_MouseDown()
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).

Jul 17 '05 #8
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_MouseDown event that looks like this:
Sub CmdNext_MouseDown()
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).

Jul 17 '05 #9

"five of nothing" <50**@mailinator.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
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).


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.
Jul 17 '05 #10

"five of nothing" <50**@mailinator.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
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).


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.
Jul 17 '05 #11
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_MouseDown(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_Mouseup(button As Integer, shift As Integer, x As
Single, y As Single)
Timer1.Enabled = False
Print "Out"
End Sub

Thanks Group

Martin

"Stephen Saunders" <kd****@earthlink.net> wrote in message
news:w3**************@newsread2.news.atl.earthlink .net...
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

Jul 17 '05 #12
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_MouseDown(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_Mouseup(button As Integer, shift As Integer, x As
Single, y As Single)
Timer1.Enabled = False
Print "Out"
End Sub

Thanks Group

Martin

"Stephen Saunders" <kd****@earthlink.net> wrote in message
news:w3**************@newsread2.news.atl.earthlink .net...
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

Jul 17 '05 #13
So I presume it worked?

Jul 17 '05 #14
So I presume it worked?

Jul 17 '05 #15
Yes, and thanks once again.

Martin

"five of nothing" <50**@mailinator.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
So I presume it worked?

Jul 17 '05 #16
Yes, and thanks once again.

Martin

"five of nothing" <50**@mailinator.com> wrote in message
news:11**********************@l41g2000cwc.googlegr oups.com...
So I presume it worked?

Jul 17 '05 #17

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by George C | last post: by
1 post views Thread by Theodore A. Jencks | last post: by
6 posts views Thread by Simon Gare | last post: by
4 posts views Thread by shapper | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.