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: Stringof 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.

 

unicode Unicode note: hints are Unicode strings for Delphi/C++Builder 2009, and ANSI strings for older versions of Delphi/C++Builder.

 

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

Cell Hints cannot be altered in this event.

 

See also:

OnGetItemCursor.

 

Example

Besides the default hint, this code displays:

for hyperlinks: tag;

for images: Delphi class type, width and height.

procedure TMyForm.MyRichViewEditItemHint(Sender: TCustomRichView;

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

var Tag: TRVTag;

    VAlign: TRVVAlign;

    Name: TRVAnsiString;

    gr: TGraphic;

begin

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

    if HintText<>'' then

      HintText := HintText+#13;

    HintText := HintText + 'Target: '+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;


TRichView © trichview.com