ITerm.CustomHyperlinkStyle

Syntax

CustomHyperlinkStyle: Boolean;

Description

The CustomHyperlinkStyle property determines the use of user hyperlink style.

Comments

The property is relevant if ITerm.IsHyperlink is set to True.

If the property is set to True, user settings of term are applied to hyperlink style, for example, color.

If the property is set to False, standard style is applied to the hyperlink.

Example

Executing the example requires a form with two buttons named Button1 and Button2 and the TermEdit component named TermEdit1. Connect to the Drawing system assembly.

    Terms: ITermList;
    Term: ITerm;    

    Sub Button1OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        color1 : IGxColor;
        color2 : IGxColor;
        color3 : IGxColor;
    Begin
        Terms := TermEdit1.Terms;
        Term := Terms.Item(0);
        Term.Text := "Text example";
        // Set up term as a hyperlink
        Term.IsHyperlink := True;
        // Use user-defined style of term hyperlink
        Term.CustomHyperlinkStyle := True;
        // Set underlining for the term
        Term.Underlined := True;
        // Create colors
        color1 := New GxColor.CreateRGB( 170,40,200);
        color2 := New GxColor.CreateRGB( 120,40,200);
        color3 := New GxColor.CreateRGB( 70,40,200);
        // Set colors for two characters of the term, starting with the first one
        Term.SetTextColor(color1,0,2);
        // Set colors for two characters of the term, starting with the third one
        Term.SetTextColor(color2,2,2);
        // Set colors for two characters of the term, starting with the fifth one
        Term.SetTextColor(color3,4,2);
    End Sub Button1OnClick;

    Sub Button2OnClick(Sender: Object; Args: IMouseEventArgs);
    Var
        Clr : IGxColor;
    Begin
        // Pass color of the first character to name of the button
        Clr := Term.GetTextColor(0);
        Button2.text := Clr.R.ToString + ", " + Clr.G.ToString + ", " + Clr.B.ToString;
        // Reset color setting of the term
        Term.ResetTextColor;
        // Remove underlining
        Term.Underlined := False;
    End Sub Button2OnClick;

After executing the example clicking the first button displays the term as a hyperlink with the user-defined style: underlined with gradient color. Clicking the second button replaces text on the button with the color of the first character of the term in the RGB format, after that the term color is reset, and underlining is removed.

See also:

ITerm