メインコンテンツまでスキップ
バージョン: 次へ

スタイル付きテキスト

ST COMPUTE EXPRESSIONS ( * ; object : Text {; startSel : Integer {; endSel : Integer}} )
ST COMPUTE EXPRESSIONS ( object : Variable, Field {; startSel : Integer {; endSel : Integer}} )

ST FREEZE EXPRESSIONS ( * ; object : Text {; startSel : Integer {; endSel : Integer}}{; *} )
ST FREEZE EXPRESSIONS ( object : Variable, Field {; startSel : Integer {; endSel : Integer}}{; *} )

ST GET ATTRIBUTES ( * ; object : Text ; startSel : Integer ; endSel : Integer ; attribName : Integer ; attribValue : Variable {; ...(attribName : Integer ; attribValue : Variable)} )
ST GET ATTRIBUTES ( object : Variable, Field ; startSel : Integer ; endSel : Integer ; attribName : Integer ; attribValue : Variable {; ...(attribName : Integer ; attribValue : Variable)} )

ST Get content type ( * ; object : Text {; startSel : Integer {; endSel : Integer {; startBlock : Integer {; endBlock : Integer}}}} ) : Integer
ST Get content type ( object : Variable, Field {; startSel : Integer {; endSel : Integer {; startBlock : Integer {; endBlock : Integer}}}} ) : Integer

ST Get expression ( * ; object : Text {; startSel : Integer {; endSel : Integer}} ) : Text
ST Get expression ( object : Variable, Field {; startSel : Integer {; endSel : Integer}} ) : Text

ST GET OPTIONS ( * ; object : Text ; option : Integer ; value : Integer {; ...(option : Integer ; value : Integer)} )
ST GET OPTIONS ( object : Variable, Field ; option : Integer ; value : Integer {; ...(option : Integer ; value : Integer)} )

ST Get plain text ( * ; object : Text {; refMode : Integer} ) : Text
ST Get plain text ( object : Variable, Field {; refMode : Integer} ) : Text

ST Get text ( * ; object : Text {; startSel : Integer {; endSel : Integer}} ) : Text
ST Get text ( object : Variable, Field {; startSel : Integer {; endSel : Integer}} ) : Text

ST GET URL ( * ; object : Text ; urlText : Text ; urlAddress : Text {; startSel : Integer {; endSel : Integer}} )
ST GET URL ( object : Variable, Field ; urlText : Text ; urlAddress : Text {; startSel : Integer {; endSel : Integer}} )

ST INSERT EXPRESSION ( {* ;} object : Object ; expression : Text {; startSel : Integer {; endSel : Integer}} )
ST INSERT URL ( * ; object : Text ; urlText : Text ; urlAddress : Text {; startSel : Integer {; endSel : Integer}} )
ST INSERT URL ( object : Variable, Field ; urlText : Text ; urlAddress : Text {; startSel : Integer {; endSel : Integer}} )

ST SET ATTRIBUTES ( * ; object : Text ; startSel : Integer ; endSel : Integer ; attribName : Integer ; attribValue : Text, Integer {; ...(attribName : Integer ; attribValue : Text, Integer)} )
ST SET ATTRIBUTES ( object : Variable, Field ; startSel : Integer ; endSel : Integer ; attribName : Integer ; attribValue : Text, Integer {; ...(attribName : Integer ; attribValue : Text, Integer)} )

ST SET OPTIONS ( * ; object : Text ; option : Integer ; value : Integer {; ...(option : Integer ; value : Integer)} )
ST SET OPTIONS ( object : Variable, Field ; option : Integer ; value : Integer {; ...(option : Integer ; value : Integer)} )

ST SET PLAIN TEXT ( * ; object : Text ; newText : Text {; startSel : Integer {; endSel : Integer}} )
ST SET PLAIN TEXT ( object : Variable, Field ; newText : Text {; startSel : Integer {; endSel : Integer}} )

ST SET TEXT ( * ; object : Text ; newText : Text {; startSel : Integer {; endSel : Integer}} )
ST SET TEXT ( object : Variable, Field ; newText : Text {; startSel : Integer {; endSel : Integer}} )

Working with text handling commands

ユーザーインターフェース

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 only. This concerns the following commands:

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)

オブジェクト (フォーム)

The commands that can be used to modify the style of objects (for example, OBJECT SET FONT) apply to the whole object and not to the selection.

If the object does not have the focus when the command is executed, the modification is applied simultaneously to the object (the text area) and to its associated variable. If the object does have the focus, the modification is carried out on the object but not on the associated variable. The modification is only applied to the variable when the object loses the focus. Keep this principle in mind when programming text areas.

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.

Note also that 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>

以下のコードを実行した場合:

OBJECT SET COLOR(*;"myArea";-(Blue+(256*Yellow)))

The red color remains:

and code is:

<span style="text-align:left;font-family:'Segoe UI';font-size:9pt;color:#0000FF">This is the word <span style="color:#D81E05">red</span></span>

The following commands are concerned:

In the context of multi-style areas, such commands should be used to set default styles only. To manage styles during database execution, we recommend using the commands of the "Styled Text" theme.

Get edited text

When it is used with a rich text area, the Get edited text command 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)

Query and order by commands

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. 例:

QUERY BY FORMULA([MyTable];ST Get plain text([MyTable]MyFieldStyle)="very well")

Automatic normalization of line endings

In order to ensure multi-platform compatibility of texts handled in the database, 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.