Would it also be possible to change dynamically the value of the
reference attribute.
(Causing deregistering/registering the delegate).
And would it be also possible to register the handler to many event
souces (= having multiple values for reference attribute).
Just asking this because without these features handler tag can not
replace Delegate class.
- rami
Recent discussions motivate being able to dynamically specify the event that a
handler is attached to and being able to dynamically enable/disable
handlers[1]. Currently, handlers can only be declaratively attached to events
by:
<handler name="eventname" ...
We propose to add two new attributes to the<handler> tag:
1.<attribute name="event" type="expression" />
If supplied, the handler will be registered to handle the event that is the
value of `event`, or if `event` is null, the handler will not be registered to
handle any events (it will have to be registered in script). When `event` is
supplied, `name` is optional, but if supplied, will be the name by which the
handler can be referenced in script. E.g.:
<handler name="startCheck" event="null">
... startCheck body ...
</handler>
<handler name="hideTip" event="null">
... hideTip body ...
</handler>
<handler name="oninit">
startCheck.register(parent, 'onmouseover');
hideTip.register(parent, 'onmouseout');
hideTip.register(parent, 'onclick');
</handler>
2.<attribute name="enabled" type="boolean" />
If supplied, this attribute controls whether or not the handler is enabled
(will react to the events it is registered on). This can be more efficient
than unregistering/reregistering events. E.g.:
<window>
<handler reference="lz.keys" name="onkeydown"
enabled="classroot.haswindowfocus">[*]
... will only execute on key down when this window has focus ...
</handler>
...
Your comments are solicited.
---
[1] See http://jira.openlaszlo.org/jira/browse/LPP-7816