History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: LPP-2106
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: P3 P3
Assignee: Philip Romanik
Reporter: Philip Romanik
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
OpenLaszlo

Documentation is wrong about simplelayout behavior

Created: 29/May/06 12:50 PM   Updated: 04/Dec/06 04:36 PM
Component/s: Documentation
Affects Version/s: 3.3
Fix Version/s: 3.4

Time Tracking:
Not Specified

Severity: Minor
Fixed in Change#: 2,853
Runtime: N/A
Fix in hand: False


 Description  « Hide
The docs for simplelayout are not correct. For example, the passage,

simplelayout places the first subview at (0, 0) and then places each subsequent subview based on the width (or height) of the previous subview, depending on which axis was specified.

indicates that simplelayout affects both axes. simplelayout affects only a single axis and leaves the other axis unchanged. This is currently a bug in the implementation of simplelayout as well.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
John Sundman - 19/Jun/06 05:32 PM

I suggested this rewording:

<p><classname>simplelayout</classname> extends
<classname>LzLayout</classname>, and therefore it is responsible for
arranging all of the subviews for the view that it is attached to. <classname>simplelayout</classname>
affects either the <attribute>x</attribute> or <attribute>y</attribute>
value, depending on the value of the <attribute>axis</attribute> attribute. <classname>simplelayout</classname> places the first subview
at (0, 0) and then places each subsequent subview based on the width
(or height) of the previous subview, depending on which axis was
specified.</p>

Jim had a comment to that this was incorrect about the placement of first subview at 0,0, but I believe that this is true. See code below. Alternatively, you can attach an onint handler to the parent view to report the x, y coordinates of its subviews.




<canvas debug="true">
  <view >
    <simplelayout axis="y" spacing="10"/>
    <view bgcolor="blue" y="40" height="30" width="50">
          <handler name="onconstruct">
           Debug.monitor(this, 'x');
           Debug.monitor(this, 'y');
           </handler>
    </view>
    <view bgcolor="blue" height="30" width="50"/>
    <view bgcolor="blue" height="30" width="50"/>
  </view>
</canvas>

John Sundman - 19/Jun/06 05:35 PM
P.S. : assigning to Jim for two reasons: technical review, and also for integration for this release if it's not too late.

Jim Grandy - 19/Jun/06 05:51 PM
No, that's still incorrect. For example:

<canvas debug="true">
   <view >
     <simplelayout axis="y" spacing="10" inset="15"/>
     <view bgcolor="blue" x="15" height="30" width="50">
       <handler name="onconstruct">
         Debug.monitor(this, 'x');
         Debug.monitor(this, 'y');
       </handler>
     </view>
     <view bgcolor="yellow" height="30" width="50"/>
     <view bgcolor="green" height="30" width="50"/>
   </view>
</canvas>

Here the first (blue) view is drawn at (15, 15). The x-axis of this view is controlled by the x attribute given in the view declaration, while the y axis value is adjusted by the inset attribute of the simplelayout.

Jim Grandy - 19/Jun/06 06:06 PM
Here's an example that allows you to interactively play with the options at work:

<canvas debug="true">
   <view>
     <simplelayout axis="y" spacing="10" inset="${layout_inset.value}"/>
     <view bgcolor="blue" x="${first_x.value}" height="30" width="50">
     </view>
     <view bgcolor="yellow" x="${second_x.value}" height="30" width="50"/>
     <view bgcolor="green" height="30" width="50"/>
   </view>
   <slider id="layout_inset" value="15"/>
   <slider id="first_x" value="20"/>
   <slider id="second_x" value="15"/>
   <simplelayout axis="y" spacing="5"/>
</canvas>

John Sundman - 19/Jun/06 06:18 PM
OK,

Thanks to lots of help, I think I've got it now. I'll file a new version shortly.

jrs

Frisco Del Rosario - 04/Dec/06 04:36 PM
Implication that simplelayout always affects both axes removed, while first code example modified to show how both axes can be affected.