setStyleAttributes
setStyleAttributes(styleNumber: Integer; fontName: String; fontSize: Integer; foreColor: Integer; backColor: Integer; fontBold: Integer; fontItalic: Integer; fontUnderline: Integer; endOfLineFill: Integer);
The setStyleAttributes method of the JadeTextEdit class sets the attributes of a text editor style. Valid style numbers are in the range 0 through 127. The actual style numbers that are used depends on the current language:
The style numbers that are common to all languages are the JadeTextEdit class constants listed in the following table.
Class Constant | Integer Value |
---|---|
STYLE_BRACEBAD | 35 |
STYLE_BRACELIGHT | 34 |
STYLE_CONTROLCHAR | 36 |
STYLE_DEFAULT | 32 |
STYLE_INDENTGUIDE | 37 |
STYLE_LINENUMBER | 33 |
STYLE_MAX | 127 |
For the STYLE_LINENUMBER (33) style, the background color is the background color for the line number and linemark margins. (Use the fold.margin.color named attribute to set the background for the fold margin.)
For the STYLE_INDENTGUIDE (37) style, the indent guide is a dotted line alternating between the foreground and background colors of this style.
Jade language style numbers are the JadeTextEdit class constants listed in the following table.
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 |
To leave an attribute unchanged, specify null ("") in the fontName parameter and specify the ATTRIB_NOCHANGE (-2) JadeTextEdit class constant for the other parameters. To set an attribute to the same value as the attribute of the default style, specify "*" in the fontName parameter and specify the ATTRIB_DEFAULT (-1) class constant for the other parameters.
Valid values for the fontSize parameter are point sizes in the range 0 through 72. The values in the range 990 through 1010 specify a size relative to the font size of the default style, in the range -10 through +10. A relative size is converted to an absolute value by adding the font size to the default style font size. The font size is always rounded up to a minimum of 2.
Set the foreColor and backColor parameters to an RGB color value, ATTRIB_NOCHANGE, or ATTRIB_DEFAULT.
Use the JadeTextEdit class constants listed in the following table to specify the values of the fontBold, fontItalic, fontUnderline, and endOfLineFill parameters, respectively.
Class Constant | Integer Value | Description |
---|---|---|
ATTRIB_DEFAULT | -1 | Use the default style value |
ATTRIB_FALSE | 0 | False |
ATTRIB_NOCHANGE | -2 | Do not change |
ATTRIB_TRUE | 1 | True |
The method in the following example shows the use of the setStyleAttributes method.
mnuEditSetMargcolor_click(menuItem: MenuItem input) updating; vars val : Integer; begin if self.askForColorSetting(self.caption, "Margin[0,1,2] Color", val) then jteSource.setStyleAttributes(JadeTextEdit.STYLE_LINENUMBER,"", JadeTextEdit.ATTRIB_NOCHANGE, JadeTextEdit.ATTRIB_NOCHANGE, val, JadeTextEdit.ATTRIB_NOCHANGE, JadeTextEdit.ATTRIB_NOCHANGE, JadeTextEdit.ATTRIB_NOCHANGE, JadeTextEdit.ATTRIB_NOCHANGE); jteSource.setNamedAttribute("fold.margin.color", val); endif; end;