4D v16.3Multi-style (Rich text area) |
||
|
4D v16.3
Multi-style (Rich text area)
Multi-style (Rich text area)
4D allows the use of rich text areas with individual style variations. For example, it is now possible to have words in bold, italics or color inside a text area: This function applies to fields and variables of the Alpha and Text type as well as to list box cells. It is supported for page and list forms both for display and printing. Note: You cannot use rich text areas in the following contexts: entry filters, quick reports and the label editor. Specific options in the Property list configure rich text functioning. The attributes available are font, size, style, text color and background color. To modify style attributes in a rich text area, there are two different possibilities:
In rich text areas, style attributes are stored as <SPAN> type HTML tags. When the text area is displayed, these tags are interpreted by 4D. This means that the developer can specify and modify style attributes in a text via programming. The <SPAN> attributes supported by 4D are described below. The ST Get plain text command retrieves raw text without style tags. For a description of the commands that manage rich text areas and the supported <span> tags, refer to the Styled Text chapter in the 4D Language Reference manual. Rich text management properties are available for enterable variables, fields and list box cells of the Alpha or Text type. This option ("Text" theme) enables the possibility of using specific styles in the selected area. When this option is checked, 4D interprets any <SPAN> HTML tags found in the area. By default, this option is not checked. This option only appears when the Multi-style option is checked. It is also found in the "Text" theme. For example, here is a text that includes a style modification: If the "Store with default style tags" option is not checked, the area only stores the modification. The stored contents are therefore: What a <SPAN STYLE="font-size:13.5pt">beautiful</SPAN> day! If the option is checked, the area stores all the formatting information. The first generic tag describes the default style then each variation is the subject of a pair of nested tags. The contents stored in the area are therefore: <SPAN STYLE="font-family:'Arial';font-size:9pt;text-align:left;font-weight:normal;font-style:normal;text-decoration:none;color:#000000;background-color:#FFFFFF">What a <SPAN STYLE="font-size:13.5pt">beautiful</SPAN> day!</SPAN> This option ("Entry" theme) only appears when the Multi-style option has been checked. The Context Menu option activates, for the user, the possibility of calling a pop-up menu during data entry by a right-click in the area:: This pop-up menu provides the following commands:
When the user modifies a style attribute via this pop-up menu, 4D generates the On After Edit form event. Notes:
The supported style attributes (font, size, style and color) are kept in the case of drag-and-drop or copy-paste of styled text between:
In other cases, the styles will be kept according to the context. Two new automatic functions are proposed when the mouse moves over a multi-style area:
Note: You can insert URL links using the ST INSERT URL command. URLs (strings starting with http://, https:// or ftp://) that are placed in multi-style fields or variables of the Text or Alpha type are detected automatically. If a user Ctrl+clicks (Windows) or Command+clicks (Mac OS) in the area, the URL is then executed directly in the default Web browser. Under Windows, detected URLs are shown in blue and underlined:
|
PROPERTIES
Product: 4D
HISTORY
TAGS texte riche, rich text area ARTICLE USAGE
4D Design Reference ( 4D v16) |