TrvActionInsertHyperlink.TerminateHyperlink

Top  Previous  Next

Helps to terminate hyperlinks when typing in rve.

procedure TerminateHyperlink(rve: TCustomRichViewEdit);

If the selection is empty, the current text item is a hyperlink, and the caret is at the end of this item, this function assigns the index non-hypertext style to the current text style (rve.CurTextStyleNo). GetNormalStyleNo is used.

Example:

procedure TForm1.RichViewEdit1KeyPress(Sender: TObject; var Key: Char);

begin

  if Key in [#13#9' '','';'then begin

    rvActionInsertHyperlink1.DetectURL(RichViewEdit1);

    rvActionInsertHyperlink1.TerminateHyperlink(RichViewEdit1);

  end;

end;

When the user types something at the end of a hyperlink, new characters are added to the hyperlink's text. But when he/she types a space character (or tab, or comma, or Enter, or semicolon), the current text style becomes a non-hypertext, so this and subsequent characters will not be added to the hyperlink's text.


RichViewActions © trichview.com