trichview.com

trichview.support.examples




Example: hypertext hint in TRichViewEdit


Return to index


Author

Message

Sergey Tkachenko

Posted: 11/05/2003 22:05:31


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