Transform events

As explained in the image above, these events are used in combination with the Program Script Task. In other words, the only way to use such an event is to link it to a certain Program Script by entering the following function in the script:

For Pascal script: <functionTransform(Obj: TTBObject; Text: String); Boolean>;

For C++ script: <bool Transform(TTBObject Obj, char Text)>;

For Java and Visual Basic script: <function Transform(Obj, Text)>;

The Transform event is used for transforming the information that is fed by a Data Provider, Net Control, or File Link to X-Pert Graphics. You can link such an event to all types of objects in X-Pert Graphics. Thus, you could change the format of the text that is provided by the data source, erase some parts of it, add new text to it, or even assign a picture to be displayed instead of the text that is being fed.

In order to create a Transform event for a certain object, two things need to happen. First, you need to save a program script, which contains the above mentioned transform function with a reference to that particular object in the Program Script Task. Then, you need to click on that object, press the Task  button on the toolbar, and go to the Transform tab. Select the script that contains the corresponding Transform function from the list in the Select Task to execute area, and press the Create Task button.

Notice that the Transform function is of type Boolean. This means that you should implement a True or a False value to be returned by your script to the particular object, containing the Transform event. If a False value is returned to the object, it will ignore the Transform event and output the information, as provided by the Data Provider linked to it. Otherwise, if the object receives a True value from the Transform function, it will show the output as it is provided by the latter.

Please, check Example 12 in Appendix 7 below to see how the Transform function works in practice.

IMPORTANT: The Transform event only executes the Transform function, shown above, NOT the whole script. Thus, you do NOT need to save a separate script file, containing the transform function only. You can simply add the desired transform function to any program script that you use for your project.

NOTE: If the script that you assign to the Transform event does NOT contain a Transform function, X-Pert Graphics will simply ignore this event. Rather, it will display the corresponding Data Provider entry exactly as it is being fed to the object, linked to it.

NOTE: If there are any modal windows (e.g., Show Message dialogs) within the Transform function, X-Pert Graphics will ignore them. This precaution is introduced for the purpose of preventing the Transform function execution from postponing.