setCharacterFormat
setCharacterFormat(selection: Boolean; faceName: String; size: Real; color: Integer; bold: Integer; italic: Integer; strikethru: Integer; underline: Integer);
The setCharacterFormat method of the JadeRichText class sets common character formatting attributes of the receiver for the selected text or new text about to be typed. (For an example of the use of this method, see "JadeRichText Control Method Example", earlier in this document.)
The setCharacterFormat method parameters are listed in the following table.
Parameter | Description |
---|---|
selection | Specify true to set the character formatting attributes of the selected text, or if no text is selected, of the insertion point and specify false to set the default character format of the control |
faceName | Sets the value of the selFontName property |
size | Sets the value of the selFontSize property |
color | Sets the value of the selTextColor property |
bold | Sets the value of the selFontBold property |
italic | Sets the value of the selFontItalic property |
strikethru | Sets the value of the selFontStrikethru property |
underline | Sets the value of the selFontUnderline property |
You can specify the CharacterFormat_Undefined value for a font parameter if you do not want to apply a new value but retain the existing value of the attribute.
This method sets only the attributes of the currently selected text or the next inserted text at that point. It does not become the default for subsequent inserted or appended text.
When the value of the selection parameter is:
-
True, the attributes of the text inserted at that point only (for example, an append) are inserted. When the selection point is moved at the end of the insertion (an append, and so on), the attributes revert to the default values for the control. If you therefore call the setCharacterFormat method followed by two calls to the append method, only the first of those append actions with those attributes is formatted.
-
False, all text in the control with those attributes is formatted (that is, it sets only the characteristics of the text next entered by the user).
Calling the load method with a replace parameter value of Load_ReplaceAll empties the control by clearing the text contents of the control but leaving the setCharacterFormat method setting for the first character in place so that it becomes the default for the control. To clear the entire contents of the control, set the text property to null ("").
Although individual properties enable you to set character formatting attributes, you should consider the number of requests made to the control, particularly when running the JADE application in thin client mode. For example, calling the setCharacterFomat method to set all character format values involves one request from the application server to the presentation client but setting values individually requires seven calls to the presentation client to set the same information.