Ctrl+Del in RVE
Posted: Fri Nov 14, 2014 7:04 pm
Ctrl+Backspace removes word at left but why Ctrl+Del doesn't work (should delete word at right)?
Any easy implementation?
Any easy implementation?
Support forums for TRichView, ScaleRichView, Report Workshop and RVMedia components
https://richedit.com/forums/
Code: Select all
Function TfmMain.DeleteToEndOfWord:boolean;
var ItemNo, WordEnd, WordStart: Integer;
s,s2: String;
CodePage: TRVCodePage;
rve1: TCustomRichViewEdit;
begin
rve1 := rve.TopLevelEditor;
ItemNo := rve1.CurItemNo;
WordEnd := rve1.OffsetInCurItem;
CodePage := rve1.RVData.GetItemCodePage(ItemNo);
if (rve1.GetItemStyle(ItemNo)<0) then exit;
s := rve1.GetItemTextW(ItemNo);
WordStart := WordEnd;
if WordStart<1 then
exit;
if s='' then exit;
//calc from cursor to end of word
while ((WordEnd<length(s)) and (not rve1.RVData.IsDelimiterA(s[WordEnd+1],codepage))) do
inc(WordEnd);
//add extra 1 to delete trailing space
if WordEnd<length(s) then inc(WordEnd);
s := Copy(s, WordStart, WordEnd-WordStart);
if s<>'' then
begin
Result:=true;
rve1.SetSelectionBounds(ItemNo, WordStart, ItemNo, WordEnd);
rve1.InsertTextW('');
end
else
Result:=false;
end;
procedure TfmMain.rveKeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
Begin
if (ssCtrl in Shift) and (key=vk_delete) then
begin
DeleteToEndOfWord;
end;
end;
Great! While you are at it, a long-time missing feature is double-click -> select word -> hold mouse button and drag -> continue selection!Sergey Tkachenko wrote:We have implemented Ctrl+Delete in TRichView 15.3, available for registered users.