4D v18Handling pictures |
||||||||||||||||||||||||
|
4D v18
Handling pictures
|
Property (constant) | Standard action |
wk anchor layout | anchorLayout |
wk anchor horizontal offset | |
wk anchor horizontal align | anchorHorizontalAlign |
wk anchor vertical offset | |
wk anchor vertical align | anchorVerticalAlign |
wk anchor origin | anchorOrigin |
wk anchor page | anchorPage |
wk anchor section | anchorSection |
moveToBack | |
moveToFront |
All anchored pictures are displayed in the Page view mode only. They're not displayed if:
You can insert 4D expressions that return pictures in your 4D Write Pro areas. Expressions can be variables, fields, project methods(*), object attributes or collection elements.
(*)Keep in mind that calling a 4D project method as an expression requires that the method has been explicitly allowed beforehand (see Managing expressions).
You can see an expression's reference in the picture tip(*):
(*)As there is no text associated with an anchored image, its expression reference cannot be displayed.
All image attributes can be applied to picture expressions (wk image and wk image url attributes 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:
Note: As with other expressions, picture expressions are also impacted by the ST COMPUTE EXPRESSIONS and ST FREEZE EXPRESSIONS commands.
Anchored picture expressions are added with the WP Add picture command (without the second parameter), followed by a call to the WP SET ATTRIBUTES command with the wk image expression selector.
Example:
obImage:=WP Add picture(myDoc)
WP SET ATTRIBUTES(obImage;wk image expression;"vpicture")
You can also insert picture expressions using WP SET ATTRIBUTES and wk image expression on existing anchored pictures.
Calling the WP RESET ATTRIBUTES command with wk image expression is similar to calling ST FREEZE EXPRESSIONS (on the entire document) in that the expression is cleared from the image attribute. However ST FREEZE EXPRESSIONS computes the expression before clearing, whereas WP RESET ATTRIBUTES does not. If an expression has never been computed, the default black frame image will be displayed.
Inline picture expressions are added with the ST INSERT EXPRESSION command.
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)
All pictures have properties (attributes) such as height, width, borders, etc., that can be get or set via the 4D Write Pro language (WP GET ATTRIBUTES and WP SET ATTRIBUTES) or standard actions.
You can work with picture references (picture variables, fields, expressions) or picture URLs (text representing a local or network address of the picture).
Two sets of attributes allow you to define if you want to set or get picture reference or a picture URL:
Example:
$range:=WP Get selection(WPArea) //get the picture selected by user
$range:=WP Picture range($range) //create a range
$url:="http://doc.4d.com/image/logo/poweredby4D_web.png"
WP SET ATTRIBUTES($range;wk image;$url) //set an image reference from a URL
//get the image
C_PICTURE(vPictureGet)
WP GET ATTRIBUTES($range;wk image;vPictureGet) //vPictureGet contains an image
C_TEXT(vPictureURLGet)
WP GET ATTRIBUTES($range;wk image url;vPictureURLGet) //vPictureURLGet=$url
The following commands can be used to return pictures:
Pictures can be manipulated via the mouse or the keyboard. Available actions include:
Product: 4D
Theme: Handling pictures
Modified: 4D v16 R6
4D Write Pro Reference ( 4D v18)