|
-
Apr 11th, 2004, 10:17 AM
#1
Thread Starter
Hyperactive Member
Button Press
Hi,
I've got two command buttons that I use to control the volume of my app.
At the moment the user presses the applicable button and the volume is adjusted either up or down.
I want to allow the user to keep the button pressed down and adjust the volume accordingly rather than having to repeatedly press the button.
Is there a way to do this?
Regards
-
Apr 11th, 2004, 11:11 AM
#2
There is one click event when the button is pressed, so that is out of the question. The solution will be trickier. What you might try doing, is starting a timer on the click event, such that every time the timer event occurs, you check to see if the mouse is still down (maybe a flag altered by some of the mouse events), and altering the volume if it is.
Another thing you might consider is the slider control. I realize that an up and down button is an intuitively correct way to handle volume, but the slider control would be as well, and the user would get visual feedback about what they are doing.
-
Apr 11th, 2004, 11:15 AM
#3
Here's a clue:
VB Code:
Private Sub Command1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Interval = 100
Timer1.Enabled = True
End Sub
Private Sub Command1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
'Code here to increase/decrease volume
End Sub
-
Apr 11th, 2004, 11:17 AM
#4
Yeah, like that, but I think the interval ought to be longer. If you've ever seen anybody who's really bad at playing Quake, setting the interval to 0.1 seconds would have that person adjusting the volume like it was a wawa pedal.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|