TE Edit Control .NET Core / .NET Framework Help
Product page

Hyperlink Hooks

The editor provides the hooks to implement hyperlink facility.

Activation

When the user double clicks on the text formatted with the double underline attribute, the editor sends a Hypertext event to the parent window. The hyperlink text format can be changed from double underline to any format of your choice by using the following code.

GetTerFields(out field)

field.LinkStyle = style-constant

field.LinkColor = color

field.LinkDblClick = set to false to activate the hyperlink on a single mouse click.

tern1.SetTerFields(field)

For a list of character styles, please refer to the SetTerCharStyle function. A special style-constant called HLINK is also available. This style does not have any visible attribute, but it allows the hyperlink text to have any mix of fonts and colors.

Event

Example:

protected void Hypertext(object Sender, 
                               ref tc.StrHyperlink link)
{
  MessageBox.Show(link.text,link.code,
                   MessageBoxButtons.OK);
  link.used=true;
} 

The 'StrHyperlink' structure is defined as following:

public struct StrHyperlink {
 public string code;       // hyperlink code
 public string text;       // hyperlink text
 public bool   DoubleClick;// TRUE if mouse double clicked,
                               otherwise single click
 public bool   used;       // the host sets it to true if it
                              acts upon this message 
};

The 'text' member variable stores the text formatted with the double underline attribute.

The 'code' member variable stores the 'hidden' text found immediately before the link text.

Your application should set the 'used' variable to a true value if it processes this message. Otherwise it should return a false value.