Ctrl+A
-
- Site Admin
- Posts: 17569
- Joined: Sat Aug 27, 2005 10:28 am
- Contact:
Re: Ctrl+A
If you use RichViewActions, there is TrvActionSelectAll, it has Ctrl+A shortcut by default.
If you do not use RichViewActions, you can use the standard action TEditSelectAll.
Or you can create a menu item or a toolbar button, assign its ShortCut = Ctrl+A, and call in OnClick:
It's also possible to implement it in OnKeyDown, but it is more difficult.
The simplest code is
But when called when the caret is in a table cell, it selects this cell, not the full editor.
It's also possible to select the whole editor from OnKeyDown, but it's more difficult (the problem of destroying cell inplace editor in OnKeyDown). I can explain a workaround, but I recommend using other methods listed above.
If you do not use RichViewActions, you can use the standard action TEditSelectAll.
Or you can create a menu item or a toolbar button, assign its ShortCut = Ctrl+A, and call in OnClick:
Code: Select all
rve.SelectAll;
rve.Invalidate;
The simplest code is
Code: Select all
procedure TForm3.RichViewEdit1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (ssCtrl in Shift) and (Key = ord('A')) then
begin
(Sender as TCustomRichViewEdit).SelectAll;
(Sender as TCustomRichViewEdit).Invalidate;
end;
end;
It's also possible to select the whole editor from OnKeyDown, but it's more difficult (the problem of destroying cell inplace editor in OnKeyDown). I can explain a workaround, but I recommend using other methods listed above.