Promotic
WikipediaLinkedInYoutubeTwitterFacebook

Object PmAction (Action)

Description:
The object represent an action that can be executed later.
Properties and methods:
Call Calling action
PrivateData Object containing designer defined properties
Note:
- The object can be created by the method Pm.CreatePmAction.
- This object is functional also for Web Panels. It is not functional in InternetExplorer8 and lower.
 
The PmAction 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 user method is called over some object using some parameters).
 
Usage of the object PmAction:

The created action can be used in two ways:

1. It can be inserted int osystem component so it is activated if needed.

In such 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 parameter.
2. The designer uses the action by calling the Call method when needed.

Example of creation and usage of PmAction object:
Create action: In this part an action of the "calling user method " type is created. It is named "MyMeth1" and located in the object where there is this script (this object is accessible by using the pMe variable).

Simultaneously the designer defined properties are set in the PrivateData object: property "id" and "val". These properties are then available when the action is activated.

Call action: 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 user method "MyMeth1" is called (method defined on the Methods page) that must have two parameters:

- oSystem: Object of the PmMap type. The properties of this object are set by system based on the source of calling.
- oPrivate: Object of the PmMap type. The properties of this object are set by the designer in the PmAction.PrivateData object.

I.e. this object contains new defined properties "id" and "val".

---------------------
Example for VBScript language:
Create action:
Dim oAction
Set oAction = Pm.CreatePmAction(1, pMe, "MyMeth1")
oAction.PrivateData.mapSetValueAt "id", "Temperature"
oAction.PrivateData.mapSetValueAt "val", 56
Call action:
oAction.Call
---------------------
Example for JavaScript language:
Create action:
var oAction = Pm.CreatePmAction(1, pMe, "MyMeth1");
oAction.PrivateData.id = "Temperature";
oAction.PrivateData.val = 56;
Call action:
oAction.Call();
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice