How do you copy and paste from a THtmlViewer object?

At the moment I have the following hack:

procedure TForm1.HTMLViewer1KeyDown(Sender: TObject; var Key: Word;
    Shift: TShiftState);
begin
    if (Key = Word('C')) and (Shift = [ssCtrl]) then
        HTMLViewer1.CopyToClipboard;
end;

Is there a more sensible/maintainable way of enabling copying from an htmlviewer? I am hoping that there is a property that I can set, or something, because having to do the above seems stupid. Descendants of TCustomEdit have copying, pasting and select-all-ing by default, but htmlviewer for some reason doesnt seem to be implemented this way.

Another problem is that the above method also doesnt account for right-clicking and selecting "copy"

EDIT: In the end I chose to replace the above code with a proper context menu, as per this tutorial: http://delphi.about.com/od/tmemotrichedit/a/richedit-popup.htm

12
задан Francisco Alvarado 29 May 2011 в 06:32
поделиться