trichview.com

trichview.support.examples




Re: Example: hypertext hint in TRichViewEdit


Return to index


Author

Message

Jonas Bilinkevicius

Posted: 11/17/2003 12:20:01


Do not forget to add "RVItem" unit to uses clause because rvbpJump is

declarated in it.

By default "RVItem" not included in uses.


Regards,

Jonas


"Sergey Tkachenko" <[email protected]> wrote in message

news:[email protected]...

> This code shows how to display hints over hypertext items in

TRichViewEdit.

> (it will work in TRichView too).

>

> A hint text is like this:

> 'Ctrl+click to go to:'

> <text from tag of the hypertext item>

>

> This code uses undocumented function GetItem().GetBoolValue().

> It's possible to do this using only documented methods (to check if the

> returned item is hotspot, hotpicture or text of a hypertext style), but it

> would produce a less compact code.

>

> RichViewEdit.ShowHint must be set to True.

>

> Event RichViewEdit1.OnMouseMove:

>

> uses CRVFData;

>

> procedure TForm1.RichViewEdit1MouseMove(Sender: TObject;

>   Shift: TShiftState; X, Y: Integer);

> var RVData: TCustomRVFormattedData;

>     ItemNo, Offs: Integer;

>     s : String;

> begin

>   inc(X, RichViewEdit1.HScrollPos);

>   inc(Y, RichViewEdit1.VScrollPos*RichViewEdit1.VSmallStep);

>   s := '';

>   if RichViewEdit1.GetItemAt(X, Y, RVData, ItemNo, Offs, True) then begin

>     if RVData.GetItem(ItemNo).GetBoolValueEx(rvbpJump,

RichViewEdit1.Style)

> then

>       s := 'Ctrl+click to go to:'#13+

>         PChar(RVData.GetItemTag(ItemNo));

>   end;

>   RichViewEdit1.Hint := s;

>   if s='' then

>     Application.CancelHint;

> end;

>

>





Powered by ABC Amber Outlook Express Converter