|
-
Nov 11th, 1999, 07:42 PM
#1
Thread Starter
New Member
Hi,
I am working on a project that involves a richtextbox.
I am currently setting up shortcut keys to activate the bold, italic and underline typefaces. I know how to do, and have succeeded with ctrl-u and ctrl-b, but with ctrl-i, it not only selects Italic, it also inserts a tab. I guess this is a default shortcut key in the rtb.
Can anyone tell me how to disable this? I suppose one way would be to assimilate a backspace press, after the italics have been set, but this is not ideal.
Many Thanks
-
Nov 11th, 1999, 07:56 PM
#2
Addicted Member
Hi!
Try:
SendKeys() function
It may work...
------------------
-
Nov 11th, 1999, 08:18 PM
#3
The reason the rtbBox inserts a tab when you press CTRL+I is because CTRL+I equals ASCII value 9 which is a tab character. To avoid this use the KeyDown event and set the KeyCode value to 0 (zero).
Private Sub RichTextBox1_KeyDown(KeyCode As Integer, Shift As Integer)
If (Shift And vbCtrlMask) = vbCtrlMask Then
Select Case KeyCode
Case vbKeyI
'set the KeyCode to 0 so the rtfBox doesn't insert a tab
KeyCode = 0
RichTextBox1.SelItalic = Not RichTextBox1.SelItalic
Case vbKeyB
RichTextBox1.SelBold = Not RichTextBox1.SelBold
Case vbKeyU
RichTextBox1.SelUnderline = Not RichTextBox1.SelUnderline
End Select
End If
End Sub
Good luck!
------------------
Joacim Andersson
[email protected]
[email protected]
www.YellowBlazer.com
-
Nov 12th, 1999, 02:49 AM
#4
Thread Starter
New Member
Cheers Joacim, thats been a great help!
Many Thanks
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
|