rvico TRichView Reference | TRichView

TCustomRichView.OnItemHint

Top  Previous  Next

Allows to define custom popup hints for items.

type

  TRVItemHintEvent = procedure (Sender: TCustomRichView;

    RVData: TCustomRVData; ItemNo: Integer; 

    var HintText: String) of object;

 

property OnItemHint: TRVItemHintEvent;

This event occurs when mouse pointer moves over the item.

Parameters

RVData – document containing this item (RichView.RVData, or table cell, or cell inplace editor's RVData)

ItemNo – index of the item inside RVData.

HintText – on input, it's a value of rvespHint item property. On output, it's a message that will be displayed.

 

Item popup hint can be displayed if rvoShowItemHints is in RichView.Options and RichView.ShowHint=True.

Cell Hints cannot be altered in this event.

 

Example

Besides the default hint, this code displays:

for hyperlinks: tag (rvoTagsArePChars must be included in MyRichViewEdit.Options);
for images: Delphi class type, width and height.

procedure TMyForm.MyRichViewEditItemHint(Sender: TCustomRichView;

  RVData: TCustomRVData; ItemNo: Integer; var HintText: String);

var Tag: Integer;

    VAlign: TRVVAlign;

    Name: String;

    gr: TGraphic;

begin

  if RVData.GetItem(ItemNo).GetBoolValueEx(rvbpJump, Sender.Stylethen begin

    if HintText<>'' then

      HintText := HintText+#13;

    HintText := HintText + 'Target: '+PChar(RVData.GetItemTag(ItemNo));

  end;

  if (RVData.GetItemStyle(ItemNo)=rvsPictureor

     (RVData.GetItemStyle(ItemNo)=rvsHotPicturethen begin

    if HintText<>'' then

      HintText := HintText+#13;

    RVData.GetPictureInfo(ItemNo, Name, gr, VAlign, Tag);

    HintText := HintText+gr.ClassName+' ('+IntToStr(gr.Width)+','+IntToStr(gr.Height)+')';

  end;

end;


RichView © Sergey Tkachenko