Control-I deletes selected text in DBRichView

General TRichView support forum. Please post your questions here
Post Reply
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Control-I deletes selected text in DBRichView

Post 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 ;
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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.
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Ctrl-I issue not like MS Word

Post by agent86 »

MS Word uses Crl-I to so italics.

Can I turn off the Ctrl-I = TAB?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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;
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Action list solved the problem. Thanks

Post by agent86 »

Is there any documentation on the action items included in the demo?
Sergey Tkachenko
Site Admin
Posts: 17557
Joined: Sat Aug 27, 2005 10:28 am
Contact:

Post 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/
agent86
Posts: 59
Joined: Mon Jun 28, 2010 2:18 am
Location: San Francisco Bay Area, USA
Contact:

Action List

Post by agent86 »

Thank you. Exactly what I needed.
Post Reply