trichview.com

trichview.support




Re: Link


Return to index


Author

Message

Sergey Tkachenko

Posted: 03/06/2004 23:00:08


1) Include rvoTagsArePChars in RichViewEdit.Option

This will allow to store strings (file names) in tags

2) You need to decide which text style (item of RVStyle.TextStyles) to use

for hyperlinks.

Hyperlink text style must have property Jump = True.

You can use some predefined text style (assigning its Jump = True), or

create a new style dynamically basing on the current text style (for

example, with the same font but blue and underlined).

In this example I'll use a predefined text style, with index = 4.

(I can make an example how to create a hyperlink style dynamically)


3) Code for hyperlink insertion:


  RichViewEdit1.CurTextStyleNo := 4;

  RichViewEdit1.InsertStringTag('Open notepad',

Integer(StrNew('notepad.exe')));


4) Process OnJump event:


uses ShellApi, CRVFData;


procedure TForm1.RichViewEdit1Jump(Sender: TObject; id: Integer);

var RVData: TCustomRVFormattedData;

    ItemNo: Integer;

    s: String;

begin

  RichViewEdit1.GetJumpPointLocation(id, RVData, ItemNo);

  s := GetTagStr(RVData.GetItemTag(ItemNo));

  ShellExecute(0, 'open', PChar(s), nil, nil, SW_SHOW);

end;


5) Include rvoCtrlJumps in RichViewEdit.EditorOptions


Now you can insert hyperlink, and Ctrl-clicking it will run Notepad.





Powered by ABC Amber Outlook Express Converter