setTextRangeToStyle

setTextRangeToStyle(firstCharacter: Integer;
                    length:         Integer;
                    styleMask:      Integer;
                    styleValue:     Integer);

The setTextRangeToStyle method of the JadeTextEdit class updates the current text style setting for each character in the specified range with the values specified in the styleMask and styleValue parameters. You can use this method, for example, to set the text range so that it is displayed marked with a specified indicator.

In the firstCharacter parameter, specify the zero-based character offset (that is, the first character of text in the control is 0, the second is 1, and so on) of the first character whose text style you want to change.

In the length parameter, specify the number of characters whose text style you want to update.

In the styleMask parameter, you can specify one or a combination of the JadeTextEdit class constants listed in the following table to define the text style indicator; that is, which of the eight style bits you want to change.

Constant Value Constant Value
SC_INDIC0_MASK #20 SC_INDIC1_MASK #40
SC_INDIC2_MASK #80 SC_INDICS_MASK #E0
SC_STYLES_MASK #1F    

Note that indicator flags of each character are cleared when the text in a text editor control is restyled (for example, by calling the restyleText method).

In the styleValue parameter, specify the text style that you require; that is, the new value for the style bits indicated in the styleMask parameter.

As the text style is usually language-dependent, the style for the Jade language could be one of the JadeTextEdit class constants listed in the following table or it could be an indicator flag.

Constant Value Constant Value
SCE_JAD_BINARYLITERAL 22 SCE_JAD_COMMENT 6
SCE_JAD_COMMENTLINE 7 SCE_JAD_DEFAULT 4
SCE_JAD_DOCTEXT 21 SCE_JAD_DOLLARIDENT 23
SCE_JAD_GLOBALCONST 17 SCE_JAD_IDENTIFIER 11
SCE_JAD_INTERFACE 20 SCE_JAD_KEYWORD 12
SCE_JAD_METHODWORD 13 SCE_JAD_NUMBER 10
SCE_JAD_PACKAGE 18 SCE_JAD_PACKAGECLASS 19
SCE_JAD_PUNCTUATION 5 SCE_JAD_SINGLECOLOR 0
SCE_JAD_STRING1 8 SCE_JAD_STRING2 9
SCE_JAD_SYSTEMCLASS 15 SCE_JAD_SYSTEMVAR 14
SCE_JAD_USERCLASS 16    

The code fragment in the following example shows the use of the setTextRangeToStyle method.

//Define indicator zero to be a red wavy underline symbol
setIndicatorAttributes(0, SC_INDIC_SQUIGGLE, Red);
//Change styling for characters 50 through 54 to set indicator 0
//(and to clear 1 and 2)
setTextRangeToStyle(50, 5, SC_INDICS_MASK, SC_INDIC0_MASK);