It's a bug! Please report.
fontsize has a setter, when you write a setter, the responsibility
for sending and event belongs to you. The setter for fontsize
doesn't send an event. Hence the bug.
The reasoning for giving setters responsibility for sending the event
is to give the setter writer more freedom; e.g., they may be able to
optimize the sending (if the attribute didn't change). But with
freedom comes responsibility. [I think either my father or George
Bush said that. :P]
On 2006-06-28, at 16:48 EDT, [EMAIL PROTECTED] wrote:
> Hi,
>
> I am confuse about the default "on"{attribute} event because it
> doesn't
> work for the "fontsize" attribute.
> Which is not concur to the 'Implicit "on" events' doc:
>
> http://www.laszlosystems.com/lps-3.3/docs/guide/methods-events-
> attributes.html#d0e14234
> =start quote=
> Any defined attribute has an associated event called "on" plus the
> name
> of the attribute.
> Whenever the value of any attribute is updated using the
> setAttribute(),
> its associated "on" event is generated.
> For example, the "height" attribute of a view has an associated
> "onheight" event that is generated whenever the view's height changes.
> These events are implicit in the sense that they are build into the
> system — you don't have to declare them or send them.
> =end quote=
>
> consider the following testcase
> Thanks
> Sanjaya
>
> <canvas debug="true">
> <simplelayout axis="y" spacing="10" />
> <method event="onfontsize" reference="mytext">
> <![CDATA[
> Debug.write('<method event="onfontsize"
> reference="mytext">');
> ]]>
> </method>
>
> <method event="ontext" reference="mytext">
> <![CDATA[
> Debug.write('<method event="ontext" reference="mytext">');
> ]]>
> </method>
>
>
> <text id="mytext" text="1" fontsize="11">
> <method event="onfontsize">
> <![CDATA[
> Debug.write('<method event="onfontsize">');
> ]]>
> </method>
>
> <method event="ontext">
> <![CDATA[
> Debug.write('<method event="ontext">');
> ]]>
> </method>
> </text>
>
> <button text="decrease text"
> onclick="mytext.setAttribute('text',(mytext.text*1)-1);"/>
> <button text="increase text"
> onclick="mytext.setAttribute('text',(mytext.text*1)+1);"/>
>
> <text id="output1" text="${mytext.text}" resize="true"/>
>
> <!-- why the "onfontsize" event doesn't get triggerred after
> modifying its value with setAttribute() ?-->
> <button text="decrease fontsize"
> onclick="mytext.setAttribute('fontsize',mytext.fontsize-1);"/>
> <button text="increase fontsize"
> onclick="mytext.setAttribute('fontsize',mytext.fontsize+1);"/>
>
> <text id="output2" text="${mytext.fontsize}" resize="true"/><!--
> why I am not automatically refreshed? -->
>
> <!-- the 'output' does get refreshed after manually sending
> 'onfontsize' event -->
> <button text="manually send 'onfontsize' event"
> onclick="mytext.onfontsize.sendEvent()" />
> </canvas>
>
>
> _______________________________________________
> Laszlo-user mailing list
> [email protected]
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user