[Laszlo-dev] For Review: Change 20081130-ptw-v Summary: Revert init arg behavior

André Bargull andre.bargull at udo.edu
Mon Dec 1 11:41:46 PST 2008


The behaviour doesn't really match 4.0, because the "iargs" are set to 
`null`, so if a user asks for "'foo' in args", it was `false` in 4.0, 
but now it's still `true` (if 'foo' is a constraint). What about 
"deleting" the values from "iargs"?

And the changed logic in "LzText#construct(..)" doesn't work, in the 
following testcase, the fontsize should be 26, but it is the default 11.
Should be like so (I think.. at least if the constraint-slot is deleted 
instead of `null`):
(see: 
http://svn.openlaszlo.org/openlaszlo/tags/4.0.14/WEB-INF/lps/lfc/views/LzText.lzs) 

> this.fontname = args.font = ('font' in args) ? args.font : this.searchParents( "fontname"  ).fontname;
> this.fontsize = args.fontsize = ('fontsize' in args) ? args.fontsize : this.searchParents( "fontsize"  ).fontsize;
> this.fontstyle = args.fontstyle = ('fontstyle' in args) ? args.fontstyle : this.searchParents( "fontstyle" ).fontstyle;
>
> this.sprite.__initTextProperties(args);
>
> delete args.font;
> delete args.fontsize;
> delete args.fontstyle;
>   


test:
---
<canvas debug="true" layout="axis:y;spacing:20" >
  <text text="Hello World!" fontsize="$once{26}" /><!-- not in 26pt -->
  <class name="myinput" extends="inputtext" >
    <method name="construct" args="p,a" >
      Debug.write("maxlength defined = %w", 'maxlength' in a);//was 
false in 4.0, now it's true
      super.construct(p,a);
    </method>
  </class>
  <myinput text="123456789" maxlength="$once{10}" width="80" 
bgcolor="#eaeaea" />
</canvas>
---

On 12/1/2008 5:55 PM, P T Withington wrote:
> Change 20081130-ptw-v by ptw at dueling-banjos.home on 2008-11-30 
> 12:01:16 EST
>     in /Users/ptw/OpenLaszlo/trunk
>     for http://svn.openlaszlo.org/openlaszlo/trunk
>
> Summary: Revert init arg behavior
>
> Bugs Fixed:
> Lpp-7378 LzTextSprite.setPattern warning in Laszlo 4.1.1, not in 4.0.12
> LPP-7386 Proposal to revert behavior of LzNode.construct to 4.1 behavior
>
> Technical Reviewer: a.bargull at intensis.de (pending)
> QA Reviewer: max (pending)
>
> Details:
>     Added a new internal API LzNode/__LZhasConstraint, which can be
>     used in LzNode/construct to determine if an attribute will be
>     constrained by LzNode/__LZapplyArgs.  This replaces testing for
>     LzInitExpr's in construct's arglist.  LzNode/construct' initargs
>     are now as they were in 4.1 -- only constant initial values appear
>     in that list.  Currently only LzText (and subclasses) use the
>     __LZhasConstraint API, because they (apparently) need to know of
>     their width/height will be constrained at construct time.  No
>     other LFC classes or component classes use this facility, so I
>     have kept is as an LFC private API.
>
>     LzTextSprite, LzInputTextSprite: These two sprite classes should
>     not be using the __LZhasConstraint API, but they are probably
>     going to be obsolete soon, so I just fixed them in the most
>     expedient way.
>
>     LzNode: Remove LzInitExprs from init args when calling construct,
>     while preserving the ability of construct replacing/adding init
>     args.
>
>     LzText:  Use new __LZhasConstraint API.
>
>     LzText, LzInputText, LaszloView: Simplify construct method, now
>     that args only contains constant values.
>
>     LzReplicationManager: Clarifying comment
>
>     hintedlayout: Fix construct arg defaulting bug noted in passing
>     (similar to LPP-7376)
>
> Tests:
>     smokecheck, ant test, test case from LPP-7386
>
> Files:
> M      WEB-INF/lps/lfc/kernel/swf/LzTextSprite.as
> M      WEB-INF/lps/lfc/kernel/swf/LzInputTextSprite.as
> M      WEB-INF/lps/lfc/kernel/swf9/LzTextSprite.as
> M      WEB-INF/lps/lfc/core/LzNode.lzs
> M      WEB-INF/lps/lfc/views/LzInputText.lzs
> M      WEB-INF/lps/lfc/views/LzText.lzs
> M      WEB-INF/lps/lfc/views/LaszloView.lzs
> M      WEB-INF/lps/lfc/data/LzReplicationManager.lzs
> M      demos/lzpixmobile/lib/hintedlayout.lzx
>
> Changeset: 
> http://svn.openlaszlo.org/openlaszlo/patches/20081130-ptw-v.tar
>


More information about the Laszlo-dev mailing list