[Laszlo-user] Views as attribute object of a class

Stéphane . s.r00t.l0gin at gmail.com
Thu Jun 1 18:38:37 EDT 2006


Hi there, I've been gone in the wrong way for a little while when I
understood how to instantiate visible components at runtime, and how to link
them to attributs of classes.

Read the following:
here aLoginSession extends view
<canvas>
<attribute name="_LoginSession" />
<view name="_view"
    width="100%"
    options="releasetolayout"
    bgcolor="olive"
 >
  <aLoginSession name="_LoginSession" />
 </view>
<method name="init" event="oninit">
this._LoginSession = this._view._LoginSession;
</method>
Then to hide it, simply this._LoginSession.setAttribute("visible", false);

I write this post because firstly I 've gone another way:
<canvas>
<attribute name="_LoginSession">
<view name="_view"
    width="100%"
    options="releasetolayout"
    bgcolor="olive"
 />
<method name="init" event="oninit">
this._LoginSession = new aLoginSession( this._view, {someAttrib:
Somevalue});
</method>

This has been tortured me for a while because init is called twice... :)

Some things to go further:
here aSession extends view
<canvas>
<attribute name="_Sessions"/>
<method name="init" event="oninit">
this._Sessions = [aSession];
</method>
<method name="doCreateSession" args="somearg">
newID = this._Sessions.length;
this._Sessions[newID] = new aSession( this._view, {somattrib: somearg});
</method>
<method name="doShowSession" args="sessionid">
this._Sessions[sessionid].showme();
</method>

Hope this will help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.openlaszlo.org/pipermail/laszlo-user/attachments/20060601/2e177a6d/attachment.html


More information about the Laszlo-user mailing list