[Laszlo-user] Layout/Positioning Problem

Daniel Salama lists at infoway.net
Sat Jun 3 11:39:27 EDT 2006


I'm fairly new as well :)

I queried the object for its subnodes and I see that in the subnodes  
array, grid appears before the view.

I assume that because objects are instantiated from the inside out,  
grid was the deepest level object defined and therefore appears first  
in the subnodes array. Thus, I assume that when asked to render, it  
renders in the order of its subnodes array.

Then, I swapped the lexical order of the elements having the view  
defined after the grid, but that didn't work either. I assume this  
behavior is due to the fact that view and grid are defined on the  
same lexical level and not that one is necessarily deeper than the  
other.

How would you propose adjusting the z-index? BringToFront or  
something like that? If the view was behind the grid, I wouldn't be  
able to see it at all.

Thanks,
Daniel

On Jun 3, 2006, at 10:50 AM, Martin Allchin wrote:

> Hi Daniel,
>
> I'm fairly new to Laszlo but from what I understand the page isn't  
> read
> from top to bottom, and some of the more nested elements can get
> rendered first.
>
> Would adjusting the z-index help? If it's just the text is being
> rendered under something else you can adjust it's z-index to bring  
> it to
> the top.
>
> Martin
>
> Daniel Salama wrote:
>> I localized an application that normally uses remote data. The code
>> is below:
>>
>> <canvas width="100%" height="100%" debug="true">
>>    <class name="mytest" extends="window">
>>      <attribute name="resultsgrid" value="null" />
>>      <attribute name="resultsmsgs" value="null" />
>>
>>      <dataset name="dset">
>>        <rsp stat="ok">
>>          <messages>
>>            <message image="error.png" code="404"/>
>>            <message image="error.png" code="405"/>
>>          </messages>
>>          <countries total="238" perpage="25" page="1" count="25"
>> pages="10">
>>            <country active="1" code="AF" name="AFGHANISTAN" id="1"/>
>>            <country active="1" code="AX" name="ALAND ISLANDS"  
>> id="2"/>
>>            <country active="1" code="DZ" name="ALGERIA" id="4"/>
>>            <country active="1" code="AS" name="AMERICAN SAMOA"  
>> id="5"/>
>>            <country active="1" code="AO" name="ANGOLA" id="7"/>
>>            <country active="1" code="AI" name="ANGUILLA" id="8"/>
>>            <country active="1" code="AQ" name="ANTARCTICA" id="9"/>
>>            <country active="1" code="AG" name="ANTIGUA AND BARBUDA"
>> id="10"/>
>>            <country active="1" code="AR" name="ARGENTINA" id="11"/>
>>            <country active="1" code="AM" name="ARMENIA" id="12"/>
>>            <country active="1" code="AW" name="ARUBA" id="13"/>
>>            <country active="1" code="AU" name="AUSTRALIA" id="14"/>
>>            <country active="1" code="AT" name="AUSTRIA" id="15"/>
>>            <country active="1" code="AZ" name="AZERBAIJAN" id="16"/>
>>            <country active="1" code="BS" name="BAHAMAS" id="17"/>
>>            <country active="1" code="BH" name="BAHRAIN" id="18"/>
>>            <country active="1" code="BD" name="BANGLADESH" id="19"/>
>>            <country active="1" code="BB" name="BARBADOS" id="20"/>
>>            <country active="1" code="BY" name="BELARUS" id="21"/>
>>            <country active="1" code="BE" name="BELGIUM" id="22"/>
>>            <country active="1" code="BZ" name="BELIZE" id="23"/>
>>            <country active="1" code="BJ" name="BENIN" id="24"/>
>>            <country active="1" code="BM" name="BERMUDA" id="25"/>
>>            <country active="1" code="BT" name="BHUTAN" id="26"/>
>>            <country active="1" code="BO" name="BOLIVIA" id="27"/>
>>          </countries>
>>        </rsp>
>>      </dataset>
>>
>>      <datapointer name="messagesdp">
>>        <handler name="ondata" args="d">
>>          <![CDATA[
>>              if ( classroot.resultsmsgs ) {
>>                classroot.resultsmsgs.setVisible( true );
>>                classroot.resultsmsgs.setDatapath
>> ( "local:classroot.dset:/rsp/messages/message" );
>>              }
>>          ]]>
>>        </handler>
>>      </datapointer>
>>
>>      <datapointer name="countriesdp">
>>        <handler name="ondata" args="d">
>>          <![CDATA[
>>              if ( classroot.resultsgrid ) {
>>                classroot.resultsgrid.setVisible( true );
>>                classroot.resultsgrid.setDatapath
>> ( "local:classroot.dset:/rsp/countries" );
>>              }
>>          ]]>
>>        </handler>
>>      </datapointer>
>>
>>      <method name="hideresults">
>>        <![CDATA[
>>            if ( resultsmsgs ) resultsmsgs.setVisible( false );
>>            if ( resultsgrid ) resultsgrid.setVisible( false );
>>        ]]>
>>      </method>
>>
>>      <method name="search">
>>        <![CDATA[
>>            hideresults;
>>            //dset.doRequest();
>>            messagesdp.setXPath( "local:dset:/rsp[@stat = 'ok']/
>> messages" );
>>            countriesdp.setXPath( "local:dset:/rsp[@stat = 'ok']/
>> countries" );
>>        ]]>
>>      </method>
>>
>>      <simplelayout axis="y" spacing="5" />
>>
>>      <button name="submit" onclick="classroot.search();">Fetch</ 
>> button>
>>
>>      <view name="window" width="${immediateparent.width}">
>>        <simplelayout axis="y" spacing="5" />
>>
>>        <view name="_messages"
>>              visible="false"
>>              width="${parent.width}">
>>
>>          <method name="init">
>>            <![CDATA[
>>               super.init();
>>               classroot.resultsmsgs = this;
>>            ]]>
>>          </method>
>>
>>          <handler name="ondata" args="d">
>>            <![CDATA[
>>               this.setVisible(true);
>>            ]]>
>>          </handler>
>>
>>          <datapath />
>>          <simplelayout axis="x" spacing="5" />
>>
>>          <text resize="true" datapath="@code" />
>>        </view>
>>
>>        <grid name="_grid"
>>              visible="false"
>>              width="${parent.width}">
>>
>>          <method name="init">
>>            <![CDATA[
>>               super.init();
>>               classroot.resultsgrid = this;
>>            ]]>
>>          </method>
>>
>>          <datapath replication="lazy" />
>>
>>          <gridtext width="30" editable="false" sortable="false"
>> datapath="position()">#</gridtext>
>>          <gridtext width="40" editable="false"  
>> datapath="@code">Code</
>> gridtext>
>>          <gridtext width="280" editable="false"
>> datapath="@name">Name</gridtext>
>>        </grid>
>>      </view>
>>    </class>
>>
>>    <mytest name="mytest1" width="500" height="400" />
>> </canvas>
>>
>> The problem I have is that when I click on Fetch, the "messages" are
>> displayed underneath the grid and I want them displayed before the
>> grid. Logically, it is defined before the grid. Why is it displayed
>> after it?
>>
>> Thanks,
>> Daniel
>>
>> _______________________________________________
>> Laszlo-user mailing list
>> Laszlo-user at openlaszlo.org
>> http://www.openlaszlo.org/mailman/listinfo/laszlo-user
>>
>>
>
>
> _______________________________________________
> Laszlo-user mailing list
> Laszlo-user at openlaszlo.org
> http://www.openlaszlo.org/mailman/listinfo/laszlo-user



More information about the Laszlo-user mailing list