|
-
Feb 9th, 2006, 07:28 PM
#1
Thread Starter
Addicted Member
mouseDown, KeyPress?
I use the Click event and it works like you would expect.
I use the keypress and it will repeat the event as long as the a key is being held down.
I use the mouseDown event and it acts like the click. It fires when the mouse button goes down. But it does not repeat while the button is held down.
How can I make it keep going while the mouse is held down.
I tried just recalling the event and it worked until it crashed with a stack overflow (all I was doing was puting a random number in the caption).
Mike
-
Feb 9th, 2006, 07:46 PM
#2
Re: mouseDown, KeyPress?
Post your code so we can see what you are trying to do.
-
Feb 9th, 2006, 07:51 PM
#3
Re: mouseDown, KeyPress?
The logic would be to enable a timer that will perform a certain action repetitivly invoked from the mousedown event. Set its interval. Then in the accompaning mouseup event you can disable the timer and it will stop firing.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Feb 9th, 2006, 09:38 PM
#4
Thread Starter
Addicted Member
Re: mouseDown, KeyPress?
All I am doing is me.caption=rnd*200
I expected it to keep looping as long as the mouse was down.
I am trying to make a fastforward button
Mike
Last edited by MikeJoel; Feb 9th, 2006 at 09:45 PM.
-
Feb 9th, 2006, 10:10 PM
#5
Re: mouseDown, KeyPress?
This increments a textbox 20 times per second when the button is held down.
You could use the form caption instead.
VB Code:
Option Explicit
Dim flag As Boolean
Private Sub Form_Load()
Randomize
End Sub
Private Sub Form_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Interval = 50
Timer1.Enabled = True
End Sub
Private Sub Form_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
Timer1.Enabled = False
End Sub
Private Sub Timer1_Timer()
Text1.Text = Rnd * 200
End Sub
-
Feb 9th, 2006, 10:20 PM
#6
Re: mouseDown, KeyPress?
Mike, the reason keypress does and mouse click doesn't is in your bios - the keyboard repeats when keys are held down, the mouse buttons don't. It's just historical - computer keys have repeated almost from the beginning, mouse buttons haven't.
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
|