[Laszlo-user] Trouble with custom events

Robin robin at kallisti.net.nz
Fri Apr 29 17:03:19 PDT 2005


Adam Wolff wrote:
> Hi Robin,
> I didn't look at this carefully, but the
> 
> <view onevent="script"
> 
> syntax only works for some of the events in Laszlo, like onclick oninit. 
> it's a bug
Hmm, it's possible you misread some of my code :) I realised afterwards 
that I should have renamed some of the objects to something less 
ambiguous than 'event' (which is just the name, as in 'sports event') 
when dealing with 'events' (as in the Laszlo thingies).

The problem is more that I can't seem to say:
<attribute name="onselected" value="null" />
in a class, and thing when I instantiate that class from somewhere else, 
say:
<eventtree onselected="parent.eventSelected()"/>
...it refuses to see 'parent' at all.

> Also, it's more idomatic to set a property and rely on that sending an 
> event, rather than sending the event explicitly. Whenever you call 
> setAttribute with an attributename, Laszlo's default behavior is to send 
> an onattributename event.
I thought about that, but it doesn't suit my situation. I'm not 
signifying data changing, I'm signifying some user feedback occurring. 
In the same way as a button shouldn't need a 'click' data field in order 
to have an 'onclick' event.

All that said, I might look into doing it this way, hopefully with 
better results.


More information about the Laszlo-user mailing list