Flash news: 4D Write Pro anchored images now support 4D Expressions!
Since 4D v16 R6, it’s been possible to add anchored images to 4D Write Pro documents. Once inserted, these images were static, either defined with a picture variable (or field), or by a picture path. Today, you have more flexibility: a valid 4D expression can also be associated to an anchored picture!
Imagine you have a background picture in your document … with a time stamp, a graphical status, a product illustration, and more. The question to ask is: “How can I make this background dynamic or context-dependent?”
Easy! Just set the new “wk image expression” attribute for any anchored image to define a method that returns a picture!
// First, create a picture inside your document
$obImage:=WP Add picture(myDoc)
// Set the expression
WP SET ATTRIBUTES($obImage;wk image expression;"TimestampPicture(0)")
// Then decorate as you want!
WP SET ATTRIBUTES($obImage;wk anchor origin;wk paper box)
WP SET ATTRIBUTES($obImage;wk anchor horizontal align;wk right)
WP SET ATTRIBUTES($obImage;wk anchor vertical align;wk top)
Note: Previously created 4D Write documents with the same kind of images can be imported as well, but make sure to “allow” the methods invoked in the imported document using the SET ALLOWED METHODS command.