4D v17

Using commands from the Styled Text theme

Home

 
4D v17
Using commands from the Styled Text theme

Using commands from the Styled Text theme  


 

 

The following commands support 4D Write Pro areas. You can use them either with a 4D Write Pro form object name (string) or a 4D Write Pro document reference (a variable of the Object type):

CommandComments
ST COMPUTE EXPRESSIONS
ST FREEZE EXPRESSIONS
ST GET ATTRIBUTES/ST SET ATTRIBUTES
ST Get content typeA new type (6) has been added for the image content type
ST Get expression / ST INSERT EXPRESSIONStarting with 4D v16, expressions are filtered by default in 4D Write Pro documents and must be explicitely allowed. For more information, refer to the Filter expressions contained in a 4D Write Pro document section. Starting with 4D v16 R5, picture expressions can be inserted (see below).
ST GET OPTIONS/ST SET OPTIONS
ST Get plain text/ST SET PLAIN TEXTStarting with 4D v17, you can get/set plain text in 4D Write Pro documents with the WP Get text and WP SET TEXT commands.
ST Get text / ST SET TEXT
ST GET URL / ST INSERT URLStarting with 4D v16 R4, you can directly handle editable URLs in any 4D Write Pro range (including pictures and cells) using the WP SET ATTRIBUTES and WP GET ATTRIBUTES commands through the wk link url attribute.

Example  

You want to replace the selection in a 4D Write Pro area with the contents of a variable:

 C_TEXT(fullName)
 
 Case of
    :(Form event=On Clicked)
       ST INSERT EXPRESSION(myArea;"fullName";ST Start highlight;ST End highlight)
 End case

You can insert special expressions related to document attributes or page attributes using the ST INSERT EXPRESSION command.

Expression syntaxAvailabilityTypeDescription
$wp_titleall parts in the documentTextTitle defined in wk title attribute
$wp_authorall parts in the documentTextAuthor defined in wk author attribute
$wp_subjectall parts in the documentTextSubject defined in wk subject attribute
$wp_companyall parts in the documentTextCompany defined in wk company attribute
$wp_notesall parts in the documentTextNotes defined in wk notes attribute
$wp_dateCreationall parts in the documentDateDate creation defined in wk date creation attribute
$wp_dateModifiedall parts in the documentDateDate modified defined in wk date modified attribute
$wp_pageNumberHeader & footer - error everywhere elseLongintPage number as it is defined: from the document start (default) or from the section page start if it is defined by section page start
$wp_pageCountHeader & footer - error everywhere elseLongIntPage count : total count of pages

To insert an expression, make sure the cursor is located in the appropriate area (header, footer, or document body) and call the ST INSERT EXPRESSION command. For example, to insert the page number in the selected footer area:

 ST INSERT EXPRESSION(*;"4DWPArea";"$wp_pageNumber")

The following document design can be defined, for example:

You can insert 4D expressions that return pictures in your 4D Write Pro areas using the ST INSERT EXPRESSION command. Expressions can be variables, fields, or 4D methods(*).

(*)Keep in mind that calling a 4D method as an expression requires that the method has been explicitely allowed beforehand (see Filter expressions contained in a 4D Write Pro document).

Examples:

  //Insert a picture variable
 ST INSERT EXPRESSION(*;"WParea";"vPicture";ST Start highlight;ST End highlight)
 
  //Insert a field
 ST INSERT EXPRESSION(*;"WParea";"[DOC]SamplePict";ST Start highlight;ST End highlight)
 
  //Insert a 4D method
 ST INSERT EXPRESSION(*;"WParea";"M_ComputeChart";ST Start highlight;ST End highlight)

You can see the expression reference in the picture tip:

All image attributes can be applied to pictures expressions (wk image attribute can only be read). Note however that since pictures have specific attributes, 4D Write Pro must evaluate the expression at least once to detect that its result is a picture and handle it as a picture expression. It means that when a picture expression is inserted with ST INSERT EXPRESSION, ST COMPUTE EXPRESSIONS must be called before setting any picture attributes.

If the image resulting from the expression could not be computed or loaded, 4D Write Pro displays the default black frame image for undefined or not found url:



See also 

Using commands from the Objects (Forms) theme

 
PROPERTIES 

Product: 4D
Theme: 4D Write Pro Language

 
PAGE CONTENTS 
 
HISTORY 

Modified: 4D v16
Modified: 4D v16 R5

 
ARTICLE USAGE

4D Write Pro Reference ( 4D v17)