TTBObject

 

This class operates all objects in X-Pert Graphics, Text objects, Pictures, Rolls and Crawls, etc. Be aware that the possible properties for all X-Pert Graphics objects are listed here. Some of them are strictly related to a particular type of object.

For example, you cannot apply [ClockPrepare] to a Text object. If you try to apply a property or method that the object in question does not support, the script engine will simply ignore it.

There are two ways, in which you can create an object in X-Pert Graphics: with the Create and with the CreateNew command (click on the arrow of the tree view to see the commands).

The Create command is used when an object has already created in the Work Area via the Object Palette. Thus, when you Create an object, you simply link your script command with that object by using the object name. If you use this option for creating objects, instead of typing in the name of the particular object, you can simply press <Ctrl> + <Alt> + <O>, which will invoke a dialog with a list of all objects in the project, like the one shown below. To select an object to link to, double-click on its name in the list.

The CreateNew command, on the other hand, is used when the object you want to create does not already exist in your project. When you create it, you can define its X and Y parameters, as well as its width and height. If you do not define any parameters, it will be placed at the (0,0) coordinate in the grid.

A description of all properties, procedures, and functions that the [TTBObject] class supports is available in Appendix 6 below. Furthermore, you can check Example 1, Example 2, Example 5, and Example 10 in Appendix 7 below to see how it works in practice.

NOTE: If you try to create a new object with the name of an existing one, be aware that X-Pert Graphics will automatically add ‘1’ to the end of the name, so that it does not coincide with the already existing name.

IMPORTANT: You should always set your objects free in your script via the Free command after you stop working with them. This is done to prevent your memory from overloading. Be aware that the Free command does not delete an objects. It simply breaks the link between the object and the program script.

NOTE: If you want to remove an object both from the script, and from the grid, you should use the Delete command.

TIP (!) Place your Free command after the Try–Finally command combination to make sure that the Free command is executed.

TIP (!) If you are using the [TTBObject] class to update text formatting in a certain text object, do NOT forget to use the UpdateParams command to apply the new formatting to the text. Check Example 5 in Appendix 7 below.