Option 5.3.4. Use a Script for a Text Object Data Source

  1. Click Script on the Data Source tab in the Text Object Properties dialog box.

  2. Click Edit.

A WYSIWYG Text Editor opens.

  1. Enter the script that you want to apply to the object.

Guidelines for the script

The Compilation and Execution of the Object script starts and ends in function Main,

Sub Main functions are mandatory.

All the references to the object inside the script use MyObject.

Review:

Text object script properties.

Text object script constants.

Text object script date and time formats.

Text object form level script functions and return types.

Note: Menu options and toolbar buttons provide the same functionality as the same items in the CIMPLICITY Program Editor.

  1. Do one of the following to compile the script.

Click the Compile button .

Click File>Compile on the WYSIWYG Form Editor menu bar.

The script is compiled. Broadcast reports errors or informs you that the script compiled successfully.

  1. Close the WYSIWYG Form Editor.

A message asks you if you want to save the script to the object.

  1. Click Yes.

The script displays as read-only text in the Script box.

Note: You can also click Compile on the Data Source tab to compile the script.

  1. Click Static.

  2. Enter a brief description of your selection in the text box.

  1. Click Apply.

  2. (Optional) Revise the font, border and position specifications to accommodate the text requirements.

Note: This can be done during any stage of the form design.

  1. Click OK.

Result: The static text entry displays in the editable form. When the form is broadcast, the dynamic selection will replace this text.

Sample Script

Sub Main

    Dim strValue as String

    strValue = Form.ItemID

    MyObject.TextValue = strValue

End Sub

More information

Step 5.3. Select a data source for the text object.