On 2009-04-25, at 18:46EDT, jamesr wrote:

I use handlers to fire functionality without actually changing any values.
An example would be

<canvas>
   <attribute name="update" type="boolean" value="false"/>
   <...>
      <handler name="onupdate" reference="canvas">
          //do something
      </handler>
   </...>
<canvas>

<method name="update">
  canvas.setAttribute('update', true);
</method>

I think a more straightforward way to do this would be:

<canvas>
   <event name="onupdate" />
   <...>
      <handler name="onupdate" reference="canvas">
          //do something
      </handler>
   </...>
<canvas>

<method name="update">
  canvas.onupdate.sendEvent(true);
</method>

You don't actually have to name your event 'on'something, that is just the convention for events that get automatically created for attributes. But you can also have straight-up events that are just used to hang handlers off of (that will all get run when the event is sent). You get to send one value along with the event, which your handler will receive, if it specifies and argument.

See also:  http://jira.openlaszlo.org/jira/browse/LPP-6034

Reply via email to