Flash news about 4D Write Pro and anchored images

Automatically translated from English

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!

4D Write Pro: Anchored pictures expressions

code example

// 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!
($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.


Roland Lannuzel

• Product Owner & 4D Expert •

After studying electronics, Roland went into industrial IT as a developer and consultant, building solutions for customers with a variety of databases and technologies. In the late 80’s he fell in love with 4D and has used it in writing business applications that include accounting, billing and email systems.

Eventually joining the company in 1997, Roland’s valuable contributions include designing specifications, testing tools, demos as well as training and speaking to the 4D community at many conferences. He continues to actively shape the future of 4D by defining new features and database development tools.