|
-
Oct 16th, 2000, 01:06 AM
#1
Thread Starter
New Member
How do I create shortcut key for various subroutines in my programs? It's like those you can set at the Menu Editor for menus, eg. Ctrl-A, F2, etc...
-
Oct 16th, 2000, 02:22 AM
#2
transcendental analytic
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
Caption = KeyCode & "," & Shift
If KeyCode = vbKeyF1 And Shift = 0 Then
'F1 and no mask keys pressed
End If
If KeyCode = Asc("A") And Shift = 2 Then
'A and Ctrl pressed
End If
keys
End Sub
check out keydown event in vb-help for combining your own mask
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 16th, 2000, 03:35 AM
#3
Thread Starter
New Member
I've tried that, but it doesn't work...
Somehow the program doesn't even repsond to the keydown event (I've tried putting a breakpoint inside Form_KeyDown). Does it have to do with the focus or something?
-
Oct 16th, 2000, 03:48 AM
#4
transcendental analytic
Oh yeah, it's the focus. Set Keypreview to true on the form, and it will catch the key events from your controls in focus too.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
Oct 16th, 2000, 04:17 AM
#5
Thread Starter
New Member
Works great now! Thanks a lot!
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
|