KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Replacing empty picture variables in 4D Write Pro
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: March 22, 2021

When using 4D Write Pro, you may have noticed that empty picture variables/expressions are displayed with a default black border as shown below:



Unfortunately these borders cannot be altered using WP SET ATTRIBUTE and the image must be replaced with another placeholder image or empty text. This can be done using the utility method below which will find all images in the document, check whether the image is null, and replace it with empty text.

C_COLLECTION($pictures_c)
C_OBJECT($item_o)
C_OBJECT($pictRange_o)

$pictures_c:=WP Get elements(WParea;wk type image)

For each ($item_o;$pictures_c)
  If ($item_o.image=Null)
    $pictRange_o:=WP Picture range($item_o)
    WP SET TEXT($pictRange_o;"";wk replace)
  End if
End for each