TrvActionInsertHyperlink.GetHyperlinkStyleNo

<< Click to display table of contents >>

TrvActionInsertHyperlink.GetHyperlinkStyleNo

Returns the index of hypertext style for the given style.

function GetHyperlinkStyleNo(rve: TCustomRichViewEdit;

  StyleNo: Integer=-1): Integer;

If StyleNo=-1, the action returns the index of hypertext style for rve.CurTextStyleNo, otherwise for StyleNo.

The appearance of the returned style depends on rve.UseStyleTemplates.

If style templates are not used, the method returns the index of style (in rve.Style.TextStyles) having all properties of the specified style, except for the properties defined in ValidProperties. For these properties, values specified  in properties of this action are used.

If style templates are used, the method returns the index of style (in rve.Style.TextStyles) having all properties of the specified style, by with the style template StyleTemplateName applied.

If a style with the required properties already exists in rve.Style.TextStyles, its index is returned. Otherwise, a new style is created and its index is returned.

This method is used in DetectURL method, or when inserting/applying hyperlink. You can use it in other cases when you need a hypertext style index.

For example, in TCustomRichViewEdit.OnReadHyperlink event:

procedure TForm1.RichViewEdit1ReadHyperlink(Sender: TCustomRichView;

  const Target, Extras: TRVUnicodeString; DocFormat: TRVLoadFormat;

  var StyleNo: Integer; var ItemTag: TRVTag;

  var ItemName: TRVUnicodeString);

begin

  if DocFormat=rvlfURL then

    StyleNo := rvActionInsertHyperlink1.GetHyperlinkStyleNo(

      RichViewEdit1);

  ItemTag := rvActionInsertHyperlink1.EncodeTarget(Target);

end;

See also methods:

GetNormalStyleNo