I want to provide keyboard shortcuts for Bold and Italics in the RTF control on my VFP9 form.
The OLEClass is Richtext.RichtextCtrl.1 ( described in the "Insert Object" dialog box as "Microsoft Rich Textbox Control, version 6.0" ).
I have been able to react to the control keys by putting this into the olecontrol.KeyDown method:
However, when the user presses Ctrl+I, it ALWAYS inserts a Tab character. This is particularly annoying if you select text, then press Ctrl+I, at which point the selected text disappears, a tab appears in its place, and the format is now Italicized.
I've tried putting this into the KeyPress Method:
... No joy.
I've tried putting this into the KeyUp method:
... still no joy (no surprise there, since you can see that the tab is inserted when Ctrl+I is pressed, and not when it is let go).
What else can I do?
Perhaps there's a windows message that can be sent to the control HWND via SendMessage to turn off this 'feature'? But where do I find the reference to show what messages I can send it?
- Bill
Get the best answers to your questions -- See FAQ481-4875.
The OLEClass is Richtext.RichtextCtrl.1 ( described in the "Insert Object" dialog box as "Microsoft Rich Textbox Control, version 6.0" ).
I have been able to react to the control keys by putting this into the olecontrol.KeyDown method:
Code:
*** ActiveX Control Event ***
LPARAMETERS keycode, shift
IF shift=2
DO CASE
CASE keycode=66 && Ctrl+B
THIS.SelBold = NOT THIS.SelBold
NODEFAULT
CASE keycode=73 && Ctrl+I
THIS.SelItalic = NOT THIS.SelItalic
NODEFAULT
CASE keycode=85 && Ctrl+U
THIS.SelUnderline = NOT THIS.SelUnderline
NODEFAULT
ENDCASE
ENDIF
However, when the user presses Ctrl+I, it ALWAYS inserts a Tab character. This is particularly annoying if you select text, then press Ctrl+I, at which point the selected text disappears, a tab appears in its place, and the format is now Italicized.
I've tried putting this into the KeyPress Method:
Code:
*** ActiveX Control Event ***
LPARAMETERS keyascii
IF keyascii=9
NODEFAULT
ENDIF
I've tried putting this into the KeyUp method:
Code:
*** ActiveX Control Event ***
LPARAMETERS keycode, shift
IF keycode=73 AND shift=2
NODEFAULT
ENDIF
What else can I do?
Perhaps there's a windows message that can be sent to the control HWND via SendMessage to turn off this 'feature'? But where do I find the reference to show what messages I can send it?
- Bill
Get the best answers to your questions -- See FAQ481-4875.