4D v14.3Programming Notes |
||||||||
|
4D v14.3
Programming Notes
Programming Notes
The commands that can be used to manipulate text objects by programming do not take any style tags integrated into the text into account. They act upon displayed text so they function as in previous versions of 4D. This concerns the following commands: Note that when you use these commands with commands that manipulate character strings, it is necessary to filter the formatting characters using the ST Get plain text command: HIGHLIGHT TEXT([Products]Notes;1;Length(ST Get plain text([Products]Notes))+1)
If the "Store with default style tags" option is checked for the object, the use of these commands will cause a modification of the tags saved with each object. Starting with 4D v14, a new way of interacting has been defined between generic commands such as OBJECT SET RGB COLORS or OBJECT SET FONT STYLE and multi-style text areas. In previous versions of 4D, executing one of these commands modified the contents of any custom style tags inserted in the area. From now on, only default properties are affected by these commands (as well as any properties saved by means of default tags). Custom style tags remain as they are. For example, given a multi-style area where default tags were saved: The plain text of the area is as follows: <span style="text-align:left;font-family:'Segoe UI';font-size:9pt;color:#009900">This is the word <span style="color:#D81E05">red</span></span> If you execute the following code: OBJECT SET COLOR(*;"myArea";-(Blue+(256*Yellow))) With 4D v14, the red color remains:
The following generic commands are concerned: OBJECT SET RGB COLORS In the context of multi-style areas, generic commands should be used to set default styles only. To manage styles during database execution, we recommend using the commands of the "" theme. When it is used with a rich text area, the Get edited text command (Form Events theme) returns the text of the current area including any style tags. To retrieve the "plain" text (text without tags) being edited, you must use the ST Get plain text command: ST Get plain text(Get edited text) Queries and sorts carried out among multi-style objects take into account any style tags saved in the object. If a style modification has been made within a word, searching for the word will not be successful. To be able to carry out valid searches and sorts, you must use the ST Get plain text command. For example: QUERY BY FORMULA([MyTable];ST Get plain text([MyTable]MyFieldStyle)="very well") In order to ensure greater multi-platform compatibility of texts handled in the database, beginning with v14, 4D automatically normalizes line endings so that they occupy a single character: '\r' (carriage return). This normalization is carried out at the level of form objects (variables or fields) hosting plain or multi-style text. Line endings that are not native, or that use a mix of several characters (for example '\r\n'), are considered as a single '\r'. Note that in compliance with the XML standard (multi-style text format), the multi-style text commands also normalize line endings for text variables that are not associated with objects. This principle makes it easier to use multi-style text commands or commands such as HIGHLIGHT TEXT in a multi-platform context. However, you must take this into account in your processing when you work with texts from heterogeneous sources. |
PROPERTIES
Product: 4D SEE ALSO
OBJECT SET COLOR ARTICLE USAGE
4D Language Reference ( 4D v14 R2) |
||||||