Attaches a handler method for the named event to the object that contains this element.
The handler method must have a name.
The name attribute gives the event for which this handler should be invoked.
Events can be declared via the <event> tag.
Events are also generated whenever the value of an attribute is changed using the setAttribute() method.
For example, if a handler is defined via:
<view id="obj">
<handler name="onmyevent" args="a">
this.setBGColor(0xff0000);
Debug.write(this,'got onblah event, arg is',a);
</handler>
</view>
then script code obj.onmyevent.sendEvent(259) will invoke this handler method.
The argument passed to an event handler is whatever value was used in the call to sendEvent() which generated the event.
In the case where an attribute value is set using setAttribute(), the new value is sent as the argument to sendEvent(),
and that will be the argument value received to any user-defined handler for that event.
| Name | Type (tag) | Type (js) | Default | Category |
|---|---|---|---|---|
args
|
string | String | initialize-only | |
| The parameter names of this handler. The value of this attribute is a comma-separated list of JavaScript identifiers. | ||||
method
|
string | String | initialize-only | |
| A method to call when this handler is invoked. | ||||
name
|
token | String | initialize-only | |
The name of a variable that will be set to this object when the application is started.
If this element is directly within a <canvas>
or <library> element, the global variable
and the canvas property with this name will be set to this object. If this element is within another object,
that object's property with this name will be set to this object.
|
||||
reference
|
reference | reference | initialize-only | |
If this attribute is present, it is a JavaScript expression that evaluates to an object.
The code in this method executes when this object sends the event named by the event attribute.
This attribute may be present only if the event attribute is present too.
|
||||
Copyright © 2002-2008 Laszlo Systems, Inc. All Rights Reserved. Unauthorized use, duplication or distribution is strictly prohibited. This is the proprietary information of Laszlo Systems, Inc. Use is subject to license terms.