[Laszlo-dev] more state hair, reference to "classroot" from a state method

P T Withington ptw at pobox.com
Thu May 1 05:11:11 PDT 2008


Clearly that's not acceptable.  We have to make this work without the  
LZX user having to add lot's of 'this's.

LPP-5624 is the placeholder for an eventual solution to the problem.   
Feel free to comment there.

On 2008-04-30, at 17:12 EDT, Philip Romanik wrote:

> Hi Henry,
>
> When I was playing around with the contactlist demo, I had to add  
> 'this' all over the place to make these errors go away.
>
>
>
>
>
>> photo.lzx:
>> This code in the lzpix app causes some compile time errors like this:
>>
>> [/tmp/lzswf9/lzgen49044/$lzc$class_state_$$2E$2E$2F$2E$2E$2Fdemos 
>> $2Flzpix$2Fclasses$2Fphoto$2Elzx_163_54.as: 10] line 163: Error:  
>> Access of undefined property classroot.
>>
>>
>>        <view name="intparent" clip="true"  
>> x="$once{ classroot.border }"
>>              y="$once{ classroot.border }">
>>            <view name="interior" bgcolor="0xd9d9d9" stretches="both">
>>                <state apply="${classroot.doesdrag}">
>>                    <handler name="onmousedown">
>>                        classroot.onmousedown.sendEvent();
>>                    </handler>
>>                    <handler name="onmouseup">
>>                        classroot.onmouseup.sendEvent();
>>                    </handler>
>>                </state>
>>            </view>
>>        </view>
>>
>>
>> because "classroot" is not an instance var of LzState. Both the  
>> constraint and it's dependency function
>> need to reference "classroot".
>>
>> Making these into references to  "this.classroot" makes the  
>> compiler happy, and presumably
>> that would work at runtime because "this" would be bound  
>> dynamically to the instance which owns the state?
>> yikes.
>>
>> --
>> Henry Minsky
>> Software Architect
>> <mailto:hminsky at laszlosystems.com>hminsky at laszlosystems.com



More information about the Laszlo-dev mailing list