Page 1 of 1

Control-I deletes selected text in DBRichView

Posted: Wed Feb 02, 2011 7:41 am
by agent86
I am using the one of the demos. Whn I select text and press Ctrl-I it deletes the selected word. I want to use Control-I to get italics. I've tempoarily set it up to use Ctrl-K to do italics. Any idea why Ctrl-I deletes the selected text? Underline and Bold work great.

// shortcuts for Bold, Underline and Italic
if ( ActiveControl = rve ) then
begin
// Bold
if ( (ssCtrl in Shift) and ( key = ord('B')) ) then
begin
// simulate button press
if btnBold.Down = False then
btnBold.Down := True
else
btnBold.Down := False ;

rve.ApplyStyleConversion(1); // bold tag

end ;

// italics
if ( (ssCtrl in Shift) and ( key = ord('K')) ) then
begin
// simulate button press
if btnItalic.Down = False then
btnItalic.Down := True
else
btnItalic.Down := False ;

rve.ApplyStyleConversion(2); // italics tag

end ;


// underline
if ( (ssCtrl in Shift) and ( key = ord('U')) ) then
begin
// simulate button press
if btnUnderline.Down = False then
btnUnderline.Down := True
else
btnUnderline.Down := False ;

rve.ApplyStyleConversion(3); // italics tag

end ;

Posted: Wed Feb 02, 2011 10:25 am
by Sergey Tkachenko
Ctrl+I generates a tab character, you can see it in other editors, for example in Notepad.
So I still suggest to create an action or menu item for this command, and assign Ctrl+I shortcut to it.

Ctrl-I issue not like MS Word

Posted: Wed Feb 02, 2011 3:05 pm
by agent86
MS Word uses Crl-I to so italics.

Can I turn off the Ctrl-I = TAB?

Posted: Wed Feb 02, 2011 4:56 pm
by Sergey Tkachenko
It's not TRichViewEdit who converts Ctrl+I to Tab.
It is made by Windows itself, so you cannot disable this conversion.

I suggested a simple solution - if you create an action or menu item with Ctrl+I shortcut, this key combination will be processed before it will be sent to the editor.

Another solution is adding the following code in OnKeyDown and OnKeyPress:

Code: Select all

var IgnoreNextTab: Boolean = False;

procedure TForm1.rveKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
  IgnoreNextTab := (Key=ord('I')) and (Shift=[ssCtrl]);
end;

procedure TForm1.rveKeyPress(Sender: TObject; var Key: Char);
begin
  if IgnoreNextTab and (Key=#9) then
    Key := #0;
  IgnoreNextTab := False;
end;

Action list solved the problem. Thanks

Posted: Thu Feb 03, 2011 8:49 pm
by agent86
Is there any documentation on the action items included in the demo?

Posted: Fri Feb 04, 2011 3:45 pm
by Sergey Tkachenko
If you mean RichViewActions and ActionTest demo, all actions are completely documented.
You can find RichViewActions.chm in the zip file.
Or you can use the online manual: http://www.trichview.com/help-actions/

Action List

Posted: Fri Feb 04, 2011 4:45 pm
by agent86
Thank you. Exactly what I needed.