[Laszlo-dev] still confused about referencing node id's from methods
P T Withington
ptw at openlaszlo.org
Tue Apr 1 10:36:11 PDT 2008
That's a huge change from JS1. There must be some way to do this.
Supposedly there is an 'unnamed package' whose top-level definitions
are accessible to the entire program. So we just have to figure out
how we put our global definitions there. I'm not creating any
`global` object, just setting properties on it, so I was assuming that
`global` was an alias for this unnamed package.
I would think you would get an error trying to install the global
property if that were not true.
Maybe I don't understand about creating globals dynamically.
On 2008-04-01, at 13:26 EDT, Henry Minsky wrote:
> But we have to explicitly do a "with (...) " of that object to get
> the vars
> in scope. I think only other way to get globals is to have it in its
> own .as
> file at compile time like we do with various globals like the
> compiler flags
> ($swf9, etc)
> package {
> public var foo = 259;
> }
>
>
>
>
> On Tue, Apr 1, 2008 at 1:03 PM, P T Withington <ptw at openlaszlo.org>
> wrote:
>
>> I don't understand. Isn't global supposed to be the outermost
>> scope and
>> where free refs will be looked up?
>>
>>
>> On 2008-04-01, at 11:25 EDT, Henry Minsky wrote:
>>
>>> This code
>>> <view id="v1" width="100" height="20" bgcolor="red"/>
>>> <view id="v2" width="100" height="20" y="100" x="${v1.x +
>>> v1.width +
>>> 20}"
>>> bgcolor="blue"/>
>>>
>>> compiles to a constraint method:
>>> $lzc$bind_x$v2_$m10:
>>> function ($lzc$ignore = null) {
>>> this.setAttribute("x", v1.x + v1.width + 20);
>>> }
>>>
>>>
>>> $lzc$dependencies_x$v2_$m10:
>>> function () {
>>> return [v1, "x", v1, "width"]
>>> }
>>>
>>>
>>> But nodes which have id's set them on the "global" object. So how
>>> can
>>> we
>>> expect these references to work? Did we decide we need
>>> to put with (global) {...} around all method bodies? Or have the
>>> compiler
>>> find all id's at compile timeand make real top level vars for them?
>>>
>>> --
>>> Henry Minsky
>>> Software Architect
>>> hminsky at laszlosystems.com
>>>
>>
>>
>
>
> --
> Henry Minsky
> Software Architect
> hminsky at laszlosystems.com
More information about the Laszlo-dev
mailing list