Movicon Help on Line - Rel. 11.7.1301
Movicon offers the possibility to edit basic routines that are executed when placing Templates on Screen. Events will be made available in these routines and automatically executed by Movicon while the Template is being inserted. These events are:
OnCustomizeSimbol()
OnVariableCreating
OnVariableCreated
OnUnembedImage
You can access basic code from the "Symbols Library" by opening the "Dynamic Property Inspector" window of the Symbol in question. When opening the "Dynamic Property Inspector" of any one of the Templates in the Library, the Dropping Code tab will appear as the first item in the symbol's list of components. When selecting this tab, which usually contains the variables and codes of each of the Symbol's components, the script code of the event routines listed above will appear. Code can be inserted within in these routines to customize the Template. This functionality is very handy for setting the static properties of symbols. This can be done by using the Prop() function from the DrawCmdTarget Interface to set the concerned symbol's static properties. If these properties are set when inserting the Template by using the code contained in the Dropping Code, they will remain permanent in the symbol when saved together with the symbol and its characteristics and they will, therefore, become the symbol's unaccessible constants that cannot be changed through the symbol's properties.
The Dropping Code is useful for customizing Templates that are inserted on screen from the Library.
Once the Templates have been inserted on the screen, you can Drop Code by "Shift + Double-Clicking" on the Template or by using the "Open..." button in the Template's Properties Window. This will also allow you to modify the Template's properties afterwards.
OnCustomizeSimbol() Event
This event is executed when the Dropping Code is called, therefore while a Template is being inserted on Screen from the Symbol Library or by "Shift + Double-Clicking" on the Template after it has been inserted on Screen.
This event has the following declaration:
Sub OnCustomizeSymbol(bRet As Boolean, bShowPropInsp As Boolean, bCreateVariables As Boolean)
End Sub
This event's parameters are:
Parameters |
Description |
bRet as boolean |
When set to False, the Template insertion operation will be cancelled (default = True) |
bShowPropInsp as boolean |
When set to False, the 'Dynamic Explorer Property' window will not display after the symbol has been inserted |
bCreateVariables as Boolean |
When set to False, the Template's variables will not be inserted in the Real Time DB (default = True) |
Event OnVariableCreating()
This event is called each time a variable must be added to the project when a symbol is being inserted. In this way you will be able to execute more accurate controls on variables to be inserted with the template. This event has the following declaration:
Sub OnVariableCreating(bRet As Boolean, VariableName As String, bCreateLocal As Boolean)
End Sub
The parameters of this event are:
Parameter |
Description |
bRet as boolean |
When set to False, it cancels the operation to insert the variable (default = True). |
VariableName As String |
Contains the name of the variable to be added to the project. The value of this parameter can be changed. In this way, a variable will be inserted with a new name. If the variable identified by the "VariableName" parameter already exists, then a new variable will be added by using the same name ending in a progressive number. |
bCreateLocal As Boolean |
When set to True, the variable will be created on the screen locally. (default = False. When the symbol is inserted with the shift pressed: default = True). |
OnVariableCreated() Event
This event is executed each time a variable is created in the project while a symbol is being inserted. By using this event, you will be able to modify the properties (only those in read/write) of variables which are added to the project while a Template is being inserted.
This event has the following declaration:
Sub OnVariableCreated(VariableName As String, bCreateLocal As Boolean)
End Sub
The parameters of this event are:
Parameter |
Description |
VariableName As String |
Contains the name of the variable which has been created in the project. |
bCreateLocal As Boolean |
When the parameter's value is True, this means that the variable has been created as a local screen variable. When False, this means that the variable will be created in the RealTime DB. |
This event is executed each time an image is detected while inserting symbols. You can use this event to decide whether to keep the image embedded in the symbol or to unembed it and create the relative file.
This event has the following declaration:
Sub OnUnembedImage(bRet As Boolean, ImageName As String, bOverwrite As Boolean)
End Sub
This event's parameters are:
Parameter |
Description |
bRet as Boolean |
Permits you to choose whether to unembed the image or not to (default = 'false'). When setting this parameter to 'false', all the other parameter will be ignored. |
ImageName as String |
Contains the name of the image file. The file's name can be modified if you wish to save the image with a different name. If the new name is entered without an extension, the original file will be taken. |
bOverwrite as Boolean |
Allows you to choose whether to overwrite or not overwrite the image which is already on saved on disk (default 'true'). |