In a very basic TRichEdit C++ Builder 11.1 app, without using RichViewActions, CTRL+I seems to be inserting a tab and Shift+CTRL+I seems to insert a space.
It's very annoying and I have a bigger app where, for reasons I've not yet fathomed, the Shortcut Keys in the Actions don't fire, so I'm having to detect them in the form and then trigger the appropriate Action. But TRichEdit still carries out the CTRL+I action - inserting a tab and messing up my text.
Simple question - Can I stop TRichEdit responding to CTRL+I when no actions are wired in?
Andy
CTRL+I - what's it doing?
Re: CTRL+I - what's it doing?
It's doing a built-in tab insert. The way I override ctrl + i is to assign a popup menu with an item that has a ctrl + i shortcut assigned to it. Sergey might have another way but that's the only one I know.
-
- Site Admin
- Posts: 17554
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: CTRL+I - what's it doing?
TRichViewEdit itself does not handle Ctrl+I.
Ctrl+I inserting a tab character is a Windows feature. You can see it even in Notepad.
So the only way to avoid it is processing this shortcut yourself. Do you have some control or menu item linked with Italic (Ctrl+I) on the editor's form?
Ctrl+I inserting a tab character is a Windows feature. You can see it even in Notepad.
So the only way to avoid it is processing this shortcut yourself. Do you have some control or menu item linked with Italic (Ctrl+I) on the editor's form?
Re: CTRL+I - what's it doing?
Hi standay and Sergey
My form has an ActionList with the Richview actions in it and also a toolbar with a button linked to the Italic action (and ones for bold, underline etc).
The problem is, and I still haven't figured why, the hotkeys on the actions are not working - CTRL + I goes straight to the RichEdit and causes the behaviour I've described. As my app is a bit complex graphically, and uses an LMD control to host forms inside of other forms, I'm guessing the keyboard events are not being properly handled somewhere. A simple, standalone form does not have the problem.
In any case, standay's suggestion of having a popup menu with the same hotkeys works - I just assigned the right Action to each item in the menu and everything works ok. As I was going to have a popup menu for the Richedits in the app, this is a solution that doesn't compromise the look and feel or functionality of my app.
It still doesn't explain why the hotkeys on the toolbar don't respond, but I've seen this behaviour in C++ Builder apps going back to V5... Not sure if it happens in Delphi - I sometimes think that C++ Builder events aren't as robust as they could be, even in V11.1 Alexandria.
Thanks for your help
Andy
My form has an ActionList with the Richview actions in it and also a toolbar with a button linked to the Italic action (and ones for bold, underline etc).
The problem is, and I still haven't figured why, the hotkeys on the actions are not working - CTRL + I goes straight to the RichEdit and causes the behaviour I've described. As my app is a bit complex graphically, and uses an LMD control to host forms inside of other forms, I'm guessing the keyboard events are not being properly handled somewhere. A simple, standalone form does not have the problem.
In any case, standay's suggestion of having a popup menu with the same hotkeys works - I just assigned the right Action to each item in the menu and everything works ok. As I was going to have a popup menu for the Richedits in the app, this is a solution that doesn't compromise the look and feel or functionality of my app.
It still doesn't explain why the hotkeys on the toolbar don't respond, but I've seen this behaviour in C++ Builder apps going back to V5... Not sure if it happens in Delphi - I sometimes think that C++ Builder events aren't as robust as they could be, even in V11.1 Alexandria.
Thanks for your help
Andy
Re: CTRL+I - what's it doing?
I recently discovered this problem as well after recently moving my code to Delphi 11.3 from 10.2. What I ended up doing was capturing the key and dispatching to the action in the onkeydown event, and also the keypress event for ^I on the edit as it was echoing a tab as well.
I placed this action in a global datamodule with all of my other actions as I have multiple edits throughout my application that use the same set of actions.
Code: Select all
procedure TEditorActionsModule.OnEditKeyPress(Sender: TObject;
var Key: Char);
begin
if (key = ^I) and (HiWord(GetKeyState(vkControl)) <> 0) then
key := #0;
end;