|
-
May 2nd, 2001, 09:05 AM
#1
Thread Starter
Hyperactive Member
Assigning menu shortcuts on runtime [RESOLVED]
Is that possible?
As I have a few popupmenus that are using the same shortcut, but appears on different forms. I get an error when assigning the same shortcut in the Menu Editor. So the only way is to do it during run-time.
Thanks
Harddisk
Last edited by Harddisk; Oct 10th, 2005 at 11:42 PM.
-
May 2nd, 2001, 09:08 AM
#2
It is, using the API.
Ask Megatron how.
-
May 2nd, 2001, 09:15 AM
#3
Lively Member
hi harddisk
i tested it and received no error!
is THAT possible?
cheers
-
May 2nd, 2001, 09:32 AM
#4
u know u can delete your post...
-
May 2nd, 2001, 11:33 AM
#5
Lively Member
thanks aron, i´m new to that thing.
-
May 2nd, 2001, 12:23 PM
#6
Thread Starter
Hyperactive Member
hmmm......API again
-
May 2nd, 2001, 02:33 PM
#7
To make an event happen when a key is pressed, use the KeyPress or KeyDown events.
Code:
Private Sub Form_KeyPress(KeyAscii As Integer)
'if KeyAscii = ... Then...
MsgBox KeyAscii & Chr$(9) & Chr(KeyAscii)
End Sub
Private Sub Form_Load()
Me.KeyPreview = True
End Sub
And to have a menu and make it look like it has that big gap between, as a regular assigned shortcut would, use Chr$(9).
Code:
MyMenu.Caption = "Help" & Chr$(9) & "F1"
-
May 2nd, 2001, 04:01 PM
#8
Thread Starter
Hyperactive Member
MyMenu.Caption = "Help" & Chr$(9) & "F1"
Thanks Gates, that's just what I need.
Harddisk
-
May 2nd, 2001, 04:04 PM
#9
this can also b done via api. i have the code on a book&cd, but its at work. if u pm me w/ ur email, i can email u the code
-
May 3rd, 2001, 12:45 AM
#10
Thread Starter
Hyperactive Member
Originally posted by spetnik
this can also b done via api. i have the code on a book&cd, but its at work. if u pm me w/ ur email, i can email u the code
Thanks for the offer.
I think Matthew's suggestion is enough, it works great.
Just wanted to show the Shortcut for the user so that they know of the shortcut exists. It doesnt really work when the shortcuts are applied to context menu. 
Harddisk
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
|