User Tools

Site Tools


built_in:spinner

Differences

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

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Next revision Both sides next revision
built_in:spinner [2015/01/07 09:51]
octazid [Methods]
built_in:spinner [2015/04/02 16:30]
octazid [Spinner control]
Line 1: Line 1:
 ====== Spinner control ====== ====== Spinner control ======
 +
 +//(Description and Example taken from the DroidScript documentation)//
 +
 +=====Description=====
 +
 +Create Spinners using the **CreateSpinner** method of the [[built_in:app|app]] object:
 +<code>spin = app.CreateSpinner( list, width, height, options );</code>
 +
 +You can allow the Spinner to auto-size by leaving out the dimensions or you can specify a width and/or height as decimal fractions of the screen's width and height.
 +
 +Use the **SetOnChange** method of your spinner to set the name of a function you want to be called when the user selects an item.
 +
 +You can get the current selection of the Spinner button at any time using the **GetText** method and replace the option list at any time by using the SetList method.
 +
 +Use the **SelectItem** method to select a particular item in code
 +
 +=====Example=====
 +<code javascript>
 +function OnStart()
 +{
 +  lay = app.CreateLayout( "Linear", "VCenter,FillXY" );
 +
 +  spin = app.CreateSpinner( "Bilbo,Frodo,Gandalf", 0.4 );
 +  spin.SetOnChange( ShowSelection );
 +  spin.SelectItem( "Frodo" );
 +  lay.AddChild( spin );
 +
 +  app.AddLayout( lay );
 +}
 +
 +function ShowSelection( item )
 +{
 +  app.ShowPopup( "Selected = " + item );
 +}
 +</code>
  
 ===== Methods ===== ===== Methods =====
 Some controls use the same methods.\\ Some controls use the same methods.\\
 For examples of the **[[same methods]]** look here. For examples of the **[[same methods]]** look here.
-^Method ^Description ^ +^ Method                                                 ^ Description   
-|Spinner.Destroy() | | +| Spinner.GetAbsHeight()                                               
-|Spinner.GetAbsHeight() | | +| Spinner.GetAbsWidth()                                                
-|Spinner.GetAbsWidth() | | +| Spinner.GetHeight()                                                  
-|Spinner.GetHeight() | | +| Spinner.GetPosition()                                                
-|Spinner.GetPosition() | | +| Spinner.GetText()                                                    
-|Spinner.GetText() | | +| Spinner.GetTextSize( mode )                                          
-|Spinner.GetTextSize( mode ) | | +| Spinner.GetType()                                                    
-|Spinner.GetType() | | +| Spinner.GetVisibility()                                              
-|Spinner.GetVisibility() | | +| Spinner.GetWidth()                                                   
-|Spinner.GetWidth() | +| Spinner.SelectItem( item                             | See the info  
-|Spinner.Release() | +| Spinner.SetBackColor( colorcode                                    
-|Spinner.SelectItem( p1 ) | See the info| +| Spinner.SetBackGradient( p1,p2,p3,p4,p5,p6,p7 )                      
-|Spinner.SetBackColor( p1 ) | | +| Spinner.SetBackGradientRadial( p1,p2,p3,p4,p5,p6,p7 )                
-|Spinner.SetBackGradient( p1,p2,p3,p4,p5,p6,p7 ) | | +| Spinner.SetList( list, p2 )                                          
-|Spinner.SetBackGradientRadial( p1,p2,p3,p4,p5,p6,p7 ) | +| Spinner.SetMargins( left,top,right,bottom )                          
-|Spinner.SetBackground( p1,p2 ) | +| Spinner.SetOnChange( callback                                      
-|Spinner.SetList( p1, p2 ) | | +| Spinner.SetOnTouch( callback                                       
-|Spinner.SetMargins( left,top,right,bottom ) | | +| Spinner.SetPadding( left,top,right,bottom                          
-|Spinner.SetOnChange( p1 ) | | +| Spinner.SetPosition( left,top,width,height                         
-|Spinner.SetOnTouch( p1 ) | | +| Spinner.SetScale( x,y )                                              
-|Spinner.SetPadding( p1,p2,p3,p4 ) | | +| Spinner.SetSize( width,height                                      
-|Spinner.SetPosition( p1,p2,p3,p4 ) | | +| Spinner.SetText( text                                              
-|Spinner.SetScale( x,y ) | | +| Spinner.SetTextColor( colorcode                                    
-|Spinner.SetSize( p1,p2 ) | | +| Spinner.SetTextSize( size,mode )                                     
-|Spinner.SetText( p1 ) | | +| Spinner.SetVisibility( HideShow                                    | 
-|Spinner.SetTextColor( p1 ) | | + 
-|Spinner.SetTextSize( size,mode ) | | + 
-|Spinner.SetVisibility( p1 ) | |+----
  
 ===== Info to Version 1.15 and before ===== ===== Info to Version 1.15 and before =====
Line 59: Line 94:
 } }
 </code> </code>
- 
built_in/spinner.txt · Last modified: 2016/06/04 01:02 (external edit)