This event is generated when the user clicks on the object.

syntaxSyntax:
function OnDynamicClick(obj, cmd)

Parameters

Parameter Description
obj An object of a class derived from DlxObject.
cmd A numeric value corresponding to the parameter specified after the macro name in the ObjRun attribute or the value 65535 if no value is specified or cannot be converted to a number.

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 codeCopy 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;
	}
}

See also