Hmm, it's not really only preventing subviews from constructing and
initiating, i.e. if you ask for the "isinited"-attribute, you'll see
that the whole view don't get initiated if it has got a subview(s).
Example:
<view id="foo" initstage="defer" >
</view>
<view id="bar" initstage="defer" >
<view />
</view>
foo.isinited == true
bar.isinited == false
Unfortunately, this is working "as documented", although it is a
source of endless confusion that init stage only applies to subviews!
I think the init stage API is terrible, but don't think we can revise
it at this point.
On 2/18/2008 5:12 PM, André Bargull (JIRA) wrote:
[ http://www.openlaszlo.org/jira/browse/LPP-3262?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=41575#action_41575 ]
André Bargull commented on LPP-3262:
------------------------------------
haha, funny thing!
suppose we've got this smaller testcase:
<canvas debug="true" >
<button id="btnClick" text="Click Me!" />
<view id="foo" initstage="defer" >
<handler name="onclick" reference="btnClick" >
Debug.write( "theView - onclick" );
</handler>
</view>
<view id="bar" initstage="defer" >
<view name="someview" />
<handler name="onclick" reference="btnClick" >
Debug.write( "theView - onclick" );
</handler>
</view>
</canvas>
What happens?
"foo" hasn't got any subviews:
LzNode() -> __LZinstantiationDone() -> __LZcallInit() ->
__LZresolveReferences() //handlers get attached!
"bar" has got a subview:
LzNode() -> createChildren() //stops here
later: completeInstantiation() -> __LZinstantiationDone() -> __LZcallInit() ->
__LZresolveReferences() //finally we get our handlers!
I guess I'd change the semantics of "defer"-initstage:
if you set initstage to "defer" on a view without subviews, the view shouldn't get initiated until completeInstantiation was called, like for a view _with_ subviews.
Handlers doesn't work with nested views and initstage="defer"
-------------------------------------------------------------
Key: LPP-3262
URL: http://www.openlaszlo.org/jira/browse/LPP-3262
Project: OpenLaszlo
Issue Type: Bug
Components: Laszlo Foundation Classes (LFC)
Affects Versions: 3.3.3
Reporter: André Bargull
Assignee: P T Withington
Priority: P1
Fix For: DingDong
Attachments: handler.lzx
Handlers doesn't work if they are placed in nested views and their parent-views have initstage="defer". The same goes for defaultplacement.
So it is very frustrating for users, if they can define a handler on a normal view with initstage="defer", but not i.e. on a list, because a list uses defaultplacement.
TestCase is attached.