One further point, lzx.rnc is advisory, so giving a default value there won't result in a default value being set at run time.

jim

On Jun 27, 2007, at 4:52 AM, Henry Minsky wrote:

That is a good question.

I would say that we ought to not use defaultattrs , it is confusing and I think it is going to go
away at some point when we rewrite node init.
If a setter needs to be called when the node is initialized, we should call the
setter manually in the init code.

So your second method is probably the right one for now, until we straighten things
out.

On 6/26/07, Benjamin Shine <[EMAIL PROTECTED]> wrote:

Let's say I'm making a virtual attribute on LzText named "thickness".
Where do I specify thickness's default value? I've ran across three
likely places so far:
in lzx.rnc
by setting defaultattrs.thickness = 0; in LzText.lzs
or, in the constructor, with something like
    if ('thickness' in args && args.thickness != null) {
         this.setThickness(args.thickness);
     } else {
         this.setThickness (0);
     }

Which one of these is the "right" way, or is there another right way?

Benjamin Shine
Software Engineer, Open Laszlo / Laszlo Systems
[EMAIL PROTECTED]






--
Henry Minsky
Software Architect
[EMAIL PROTECTED]


Reply via email to