|
-
Mar 9th, 2004, 10:26 AM
#1
Thread Starter
Hyperactive Member
RichTextBox and Menu shortcuts ^M ^X
As soon as I put a RichTextBox on a form, my menu shortcuts (regular dropdown menus) for ^M and ^X stop working.
The RTB is apparently intercepting these.
I've tried various tricks like catching this in RichTextBox1_KeyDown and setting the keycode=0,
setting AutoVerbMenu true/false, Locked true/false, setting form KeyPreview true/false
etc. etc.
The only way I can get these 2 shortcuts to work is to set the RTB.Enabled=False.
Any ideas? Thanks, DaveBo
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
-
Mar 9th, 2004, 10:50 AM
#2
Thread Starter
Hyperactive Member
Workaround
I've found that:
^M won't work at all
^X won't work if the rtb is locked.
Others may also be intercepted, e.g. for the rtb popup menu.
Workaround1:
Ensure the RTB doesn't have focus.
Workaround2:
Let the RTB capture the keystrokes and redirect them.
Code:
Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
If Shift = 2 Then ' Check for some Ctrl-keys
Select Case KeyCode
Case Asc("M"): ' Trap on ^M
KeyCode = 0
mnuFileMake_Click
Case Asc("X"): ' Trap on ^X
KeyCode = 0
mnuFileExit_Click
End Select
End If
End Sub
"The wise man doesn't know all the answers, but he knows where to find them."
VBForums is one place, but for the really important stuff ... here's a clue 1Tim3:15
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
|