why it is not possible to copy selected text in TDBMemo component into clipboard? DELPHI 7, Windows Vista. Following code fails to catch ctrl+c event, whereas ctrl+a works fine.
uses clipbrd;
procedure THierarchierForm.dbm1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key=Ord('A')) and (ssCtrl IN Shift) then begin
dbm1.SelectAll;
Key:=0;
end;
if (Key=Ord('C')) and (ssCtrl IN Shift) then begin
Clipboard.AsText:=dbm1.SelText;
Key:=0;
end;
end;
Thanx
dbm1.CopyToClipboard
. – David HeffernanCopyToClipboard
does what you want. I always try to handle these events with the Shortcut property (e.g. on a menu or an action). Just writingShift=[ssCtrl]
would be better, but best of all would beShift*[ssShift,ssAlt,ssCtrl]=[ssCtrl]
but that is getting a little pedantic. Anyway, if you do it that way, move it out to a helper function. – David HeffernanTDBMemo
, but the ordinaryTMemo
handles Ctrl+C (X, V, Z) intrinsically. Anyhow, @David is right about his comments. – Andreas Rejbrand