Object PmAction (Action)
Object represents an action that can be executed later.
Properties and methods:
|Call|| Calling action|
|PrivateData|| Object containing designer defined properties|
object is handy if it is needed that "someone" creates such object (i.e. creates "action"), then passes this object forward and then "someone else sometime" executes such action. DThe important point is that "someone else" just calls the Call
method and does not need to know what is actually inside (e.g. does not know that designer's method is called over some object using some parameters).
Usage of the object PmAction
The created action can be used in two ways:
1st It can be inserted int osystem component so it is activated if needed.
In this case the designer does not call the Call method. The method is called by the system component. While calling it can also set some important information in the properties of the object that is then accessible in the called user method in the oSystem parameter.
Examples of system components that can be used for PmAction:
- Close the panel
: In the OpenView
method the action can be set in the oExtra.onClose
entry. The action is then called when the panel is closed and the ReturnValue
property is set in the oSystem
2nd The designer uses the action by calling the Call method
The example of creation and usage of PmAction object:
: In this part, an action of the type "calling the designer's method" is created. It is named "MyMeth1
" and located in the object where there is this script (this object is accessible by using the pMe
Simultaneously the designer defined properties are set in the object (that is saved in PrivateData): property "id" and "val". These properties are then available when the action is activated.
: In this place the action is activated. This script can be called "by someone else somewhere else", it only needs to have access to the created action (access to oAction
value). If the action was set in some system component, then the designer does not call the Call
method (it is called by the system itself).
This way the designer's method "MyMeth1" is called (method defined on the "Methods" page) that must have two parameters:
: Object of the PmMap
type. Properties of this object are set by system
based on the source of calling.
: Object of the PmMap
type. Properties of this object are set by the designer
in the PmAction.PrivateData
It means that this object contains new defined properties "id" and "val".
var oAction = Pm.CreatePmAction(1, pMe, "MyMeth1");
oAction.PrivateData.id = "Temperature";
oAction.PrivateData.val = 56;
: New auxiliary object. It can be used to define action - calling the designer's method of the object.