I find what I must use “RichViewEdit1WriteHyperlink” and “RichViewEdit1ReadHyperlink” properties. I insert code in it. It’s fix may problem, but when I paste formatted Text from clip boar program rise Error “List Out of bound”. How can I fix all my problems?
Code: Select all
procedure TfrmRichEditForm.RichViewEdit1ReadHyperlink(Sender: TCustomRichView;
const Target, Extras: string; DocFormat: TRVLoadFormat; var StyleNo,
ItemTag: Integer; var ItemName: TRVRawByteString);
var
lStr: String;
lPWideChar: PWideChar;
lPointer: Pointer;
begin
if DocFormat=rvlfURL then
StyleNo :=
rvActionInsertHyperlink1.GetHyperlinkStyleNo(RichViewEdit1);
lStr:= (rvActionInsertHyperlink1.EncodeTarget(Target));
New(lPWideChar);
GetMem(lPWideChar, Length(lStr)*SizeOf(Char));
Move(lPWideChar, lStr, Length(lStr));
lPointer:= lPWideChar;
ItemTag:= integer(lPointer);
end;
procedure TfrmRichEditForm.RichViewEdit1WriteHyperlink(Sender: TCustomRichView;
id: Integer; RVData: TCustomRVData; ItemNo: Integer;
SaveFormat: TRVSaveFormat; var Target, Extras: string);
var
lRVTag: TRVTag;
begin
if ItemNo >= 0 then begin
lRVTag := RichViewEdit1.GetItemTag(ItemNo);
if lRVTag > 0 then
Target:= PWideChar(lRVTag);
end;
end;