This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
built_in:app_events [2017/09/17 22:32] 5.48.46.31 [Table] |
built_in:app_events [2018/12/30 13:31] (current) |
||
---|---|---|---|
Line 89: | Line 89: | ||
} | } | ||
+ | </ | ||
+ | |||
+ | =====OnConfig===== | ||
+ | The following code can be useful if you want to change the layout in the OnConfig event. | ||
+ | |||
+ | <code javascript> | ||
+ | //Called when application is started. | ||
+ | function OnStart() | ||
+ | { | ||
+ | //Create a layout with objects vertically centered. | ||
+ | lay = app.CreateLayout( " | ||
+ | var test = app.GetOrientation(); | ||
+ | var hv = " | ||
+ | if( test==" | ||
+ | lay.SetOrientation( hv ); | ||
+ | |||
+ | txt = app.CreateText( "Hello " ); | ||
+ | txt.SetTextSize( 64); | ||
+ | lay.AddChild( txt ); | ||
+ | |||
+ | txt1 = app.CreateText( " | ||
+ | txt1.SetTextSize( 64 ); | ||
+ | lay.AddChild( txt1 ); | ||
+ | app.AddLayout( lay ); | ||
+ | } | ||
+ | //Called when screen rotates | ||
+ | function OnConfig() | ||
+ | { | ||
+ | var test = app.GetOrientation(); | ||
+ | var hv = " | ||
+ | if( test==" | ||
+ | lay.SetOrientation( hv ); | ||
+ | } | ||
</ | </ |