P T Withington wrote:

I've been confused by this too, but, it is the design.

A view will not be initialized until all its subviews have been initialized. `initstage` does two things:

1) It tells the parent of this view that it does not have to wait for this view to complete instantiation.

2) It causes the instantiation of the children of this view to be delayed.

The view with the `initstage` declaration will be initialized when its children have completed instantiation (which can be forced by calling `completeInstantiation` on the view. In your first example, since v2 has no children, it is initialized immediately.

[This article](http://www.laszlosystems.com/~adam/blog/archives/ 000027.html) by Adam may be helpful too. It has several examples exploring the use of `initstage`.

On 14 Nov 2005, at 05:14, Darren Cui Liang wrote:

I have the following piece of code:

<canvas>
   <view width="100" height="100" bgcolor="0x00ff00" name="v1" >
         <view name="v2" width="50" height="50" initstage="defer">
           <attribute name="bgcolor" value="${parent.bgcolor/2}"/>
       </view>
   </view>
</canvas>

According to my understanding of the Instantiation, the view "v2" is not initialized unless "completeInstantation()" is called. However, it is initialized.
If I add a subview to "v2":

<canvas>
   <view width="100" height="100" bgcolor="0x00ff00" name="v1" >
         <view name="v2" width="50" height="50" initstage="defer">
           <attribute name="bgcolor" value="${parent.bgcolor/2}"/>
           <view />
       </view>
   </view>
</canvas>

then "v2" is not initialized.

Is it the design or a bug?

BR
Darren Cui Liang
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user



Thanks a lot!
I want to learn more about laszlo initialization and instantiation, and I find the "Understanding Instantiation" in laszlo reference appendix is not enough. Where can I find more readings about this?

Darren
_______________________________________________
Laszlo-user mailing list
[email protected]
http://www.openlaszlo.org/mailman/listinfo/laszlo-user

Reply via email to