|
-
Nov 25th, 2001, 11:35 AM
#1
Thread Starter
PowerPoster
PopupMenus & Shortcut Keys
I have a problem with using shortcut keys in a hidden menu.
I am using a label to popup up the menu when clicked. In the menu are shorcut keys for various things. They Don't work unless i make the menu Visible, which i don't want for esthetic reasons.
Anyway to make a non visible menu respond to Shortcut keys?
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Nov 25th, 2001, 11:40 AM
#2
What is the code you are using ?
-
Nov 25th, 2001, 11:50 AM
#3
No you have to handle the Shortcuts through code.
You can do this in the KeyDown event of your Form if you set the KeyPreview property to True.
Let say, for example, that you have 3 menu items in the hidden popup menu and the items are called mnuPop1, mnuPop2 and mnuPop3.
To these menu items you've added Ctrl+A, Ctrl+B and Ctrl+C as the shortcuts.
Then add the following code in the KeyDown event of the Form (remember that KeyPreview must be True)
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
If (Shift And vbCtrlMask) = vbCtrlMask Then
Select Case KeyCode
Case vbKeyA
mnuPop1_Click
Case vbKeyB
mnuPop2_Click
Case vbKeyC
mnuPop3_Click
End Select
End If
End Sub
Best regards
-
Nov 25th, 2001, 12:06 PM
#4
Thread Starter
PowerPoster
Thanks alot. Any idea what the Keycode is for the F keys? I.e. F1 F2 F3 ect...
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

-
Nov 25th, 2001, 12:08 PM
#5
-
Nov 25th, 2001, 12:09 PM
#6
Yes DaoK is correct. The function keys are simply vbKeyF1 to vbKeyF12
-
Nov 25th, 2001, 12:19 PM
#7
Thread Starter
PowerPoster
Thanks alot guys.. works perfectly.
-We have enough youth. How about a fountain of "Smart"?
-If you can read this, thank a teacher....and since it's in English, thank a soldier.

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
|