KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Be careful when calling ST INSERT EXPRESSION from inside a subform
PRODUCT: 4D | VERSION: 18 | PLATFORM: Mac & Win
Published On: June 14, 2021

The command ST INSERT EXPRESSION may be used to add an expression to existing content in an object such as a Write Pro area. When it is called from a subform (for example, as a button in a toolbar) the command may produce unexpected results. Generally, if the “Focusable” property is enabled on the subform object, ST INSERT EXPRESSION will replace the entire contents of the Write Pro document with the expression, instead of just adding the expression to the existing content. This is due to the subform regaining focus when the user clicks on the button inside the subform, taking away the scope of the Write Pro area and losing the cursor position. When this happens, ST INSERT EXPRESSION adds the expression to the beginning of the Write Pro document, ignoring and replacing any existing content.