antun
04-24-2003, 02:37 PM
Note: You will not notice the difference in instantiation time in the examples given in this tip - they are simply too small (and therefore fast at initializing).
As your applications get more and more complex, you're going to want to control the time that various elements appear on the canvas while the app is initializing.
By default, views will wait until they are all initialized and then display. This can be frustrating if view instantiation takes a long time, as the application will appear blank. To cause a view to be initialized before the bulk of views, use the initstage="early" attribute:
<canvas>
<view bgcolor="red" width="50" height="50"
initstage="early" />
<view bgcolor="blue" width="50" height="50" y="75" />
</canvas>
A good use for this would be to show some UI elements while the rest of the application is starting up, so that the user does not get impatient.
To cause a view to be instantiated after the bulk of views, use the initstage="late" attribute:
<canvas>
<view bgcolor="red" width="50" height="50"
initstage="early" />
<view bgcolor="blue" width="50" height="50" y="75" />
<view bgcolor="green" width="50" height="50" y="150"
initstage="late" />
</canvas>
This is handy when an application is large and slow to start up, and you want to defer the instantiation of some views (which the user might not come to until a few clicks into the application), so that the application appears sooner.
By default a view's initstage is "normal". Constraints cannot be resolved across init stages.
Enjoy!
As your applications get more and more complex, you're going to want to control the time that various elements appear on the canvas while the app is initializing.
By default, views will wait until they are all initialized and then display. This can be frustrating if view instantiation takes a long time, as the application will appear blank. To cause a view to be initialized before the bulk of views, use the initstage="early" attribute:
<canvas>
<view bgcolor="red" width="50" height="50"
initstage="early" />
<view bgcolor="blue" width="50" height="50" y="75" />
</canvas>
A good use for this would be to show some UI elements while the rest of the application is starting up, so that the user does not get impatient.
To cause a view to be instantiated after the bulk of views, use the initstage="late" attribute:
<canvas>
<view bgcolor="red" width="50" height="50"
initstage="early" />
<view bgcolor="blue" width="50" height="50" y="75" />
<view bgcolor="green" width="50" height="50" y="150"
initstage="late" />
</canvas>
This is handy when an application is large and slow to start up, and you want to defer the instantiation of some views (which the user might not come to until a few clicks into the application), so that the application appears sooner.
By default a view's initstage is "normal". Constraints cannot be resolved across init stages.
Enjoy!