This event is generated when the user clicks on the object.
Syntax: |
---|
function OnDynamicClick(obj, cmd) |
Parameters
Remarks
The purpose of this function is to execute the action corresponding to the selected command. The event is only generated if the object is not selected.
Example
The dynamic object consists of a group of three objects. Two objects activate the macro when you click on them. The third object is a text named "counter" in which the numeric value is displayed.
Copy code | |
---|---|
function OnDynamicClick(obj, cmd)
{
if (obj.GetType() != DlxApp.OBJTYPE_TEXT)
return;
if (!obj.GetParent().IsValid())
return;
var text = obj.GetParent().GetChild("counter");
if (!text.IsValid())
return;
var value = text.GetText(true);
switch (cmd)
{
case 0:
value++;
text.SetText(value.toString());
break;
case 1:
value--;
text.SetText(value.toString());
break;
}
}
|