DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


built_in:tabs

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
built_in:tabs [2015/01/07 09:52]
octazid [Methods]
built_in:tabs [2015/03/22 13:12] (current)
octazid [Methods]
Line 26: Line 26:
 |Tabs.SetBackground( p1,p2 ) | | |Tabs.SetBackground( p1,p2 ) | |
 |Tabs.SetMargins( left,​top,​right,​bottom ) | | |Tabs.SetMargins( left,​top,​right,​bottom ) | |
-|Tabs.SetOnChange( ​cb ) | |+|Tabs.SetOnChange( ​callback ​) | |
 |Tabs.SetOrientation( p1 ) | | |Tabs.SetOrientation( p1 ) | |
 |Tabs.SetPadding( p1,p2,p3,p4 ) | | |Tabs.SetPadding( p1,p2,p3,p4 ) | |
Line 35: Line 35:
 |Tabs.SetVisibility( p1 ) | | |Tabs.SetVisibility( p1 ) | |
 |Tabs.ShowTab( name )| | |Tabs.ShowTab( name )| |
 +
 +=====Example=====
 +//(Example taken from the DroidScript sample section)//
 +
 +<code javascript>​
 +//​Called when application is started.
 +function OnStart()
 +{
 + //​Create a layout with objects vertically centered.
 + lay = app.CreateLayout( "​linear",​ "​VCenter,​FillXY"​ );​
 +
 + //​Create tabs.
 +    var tabs = app.CreateTabs( "​FRED,​BILL,​MARK",​ 0.8,​ 0.8,​ "​VCenter"​ );​
 +    tabs.SetOnChange( tabs_OnChange );​ 
 +    lay.AddChild( tabs );​ 
 +    
 +    //​Add button to first tab.
 +    layFred = tabs.GetLayout( "​FRED"​ );​
 +    btn = app.CreateButton( "​Button"​ );​
 +    layFred.AddChild( btn );​
 +    
 +    //​Add button to second tab.
 +    layBill = tabs.GetLayout( "​BILL"​ );​
 +    chk = app.CreateCheckBox( "​CheckBox"​ );​
 +    layBill.AddChild( chk );​
 +
 + //​Add layout to app.
 + app.AddLayout( lay );​
 +}
 +
 +//​Handle tab selection.
 +function tabs_OnChange( name )
 +{
 +    app.ShowPopup( name );​
 +}</​code>​
built_in/tabs.txt · Last modified: 2015/03/22 13:12 by octazid