User Tools

Site Tools


built_in:seekbars

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
built_in:seekbars [2014/12/05 13:39]
162.252.85.172 [Methods]
built_in:seekbars [2016/09/19 02:18] (current)
Line 1: Line 1:
 ====== Seekbars ====== ====== Seekbars ======
-===== Create ===== + 
-Create SeekBars using the CreateSeekBar method of the app object:+//(Information and examples taken from the DroidScript documentation)// 
 + 
 +===== Description ===== 
 +Create SeekBars using the **CreateSeekBar** method of the **[[built_in:app|app]]** object:
 <code>skb = app.CreateSeekBar( width, height );</code> <code>skb = app.CreateSeekBar( width, height );</code>
-The SetRange method of the SeekBar object to sets the value range of the SeekBar and the SetValue method sets the current value.+The **SetRange** method of the SeekBar object to sets the value range of the SeekBar and the **SetValue** method sets the current value. 
 + 
 +Use the **SetOnTouch** method of the SeekBar object to set the name of a function you want to be called when the SeekBar is touched. You can read the 'value' parameter in your callback function to get the position value of the SeekBar 
 + 
 +====Example==== 
 +<code javascript> 
 +function OnStart() 
 +
 +  lay = app.CreateLayout( "Linear", "VCenter,FillXY" ); 
 + 
 +  skb = app.CreateSeekBar( 0.8 ); 
 +  skb.SetRange( 1.0 ); 
 +  skb.SetValue( 0.5 ); 
 +  skb.SetOnTouch( skb_OnTouch ); 
 +  lay.AddChild( skb ); 
 + 
 +  app.AddLayout( lay ); 
 +
 + 
 +function skb_OnTouch( value ) 
 +
 +  app.ShowPopup( "Value = " + value ); 
 +
 +</code>
  
-Use the SetOnTouch method of the SeekBar object to set the name of a function you want to be called when the SeekBar is touched. You can read the 'value' parameter in your callback function to get the position value of the SeekBar 
 ===== Methods ===== ===== Methods =====
-^Method ^Description ^ +Some controls use the same methods.\\ 
-|SeekBar.Destroy() | | +For examples of the **[[same methods]]** look here. 
-|SeekBar.GetAbsHeight() | | +^ Method                                                          ^ Description                                                                                                                                                                                                                                                                                              
-|SeekBar.GetAbsWidth() | | +| SeekBar.Destroy()                                                                                                                                                                                                                                                                                                                                                        
-|SeekBar.GetHeight() | | +| SeekBar.GetAbsHeight()                                                                                                                                                                                                                                                                                                                                                   
-|SeekBar.GetPosition() | | +| SeekBar.GetAbsWidth()                                                                                                                                                                                                                                                                                                                                                    
-|SeekBar.GetType() | | +| SeekBar.GetHeight()                                                                                                                                                                                                                                                                                                                                                      
-|SeekBar.GetValue() | | +| SeekBar.GetPosition()                                                                                                                                                                                                                                                                                                                                                    
-|SeekBar.GetVisibility() | | +| SeekBar.GetType()                                                                                                                                                                                                                                                                                                                                                        
-|SeekBar.GetWidth() | | +| SeekBar.GetValue()                                                                                                                                                                                                                                                                                                                                                       
-|SeekBar.Release() | | +| SeekBar.GetVisibility()                                                                                                                                                                                                                                                                                                                                                  
-|SeekBar.SetBackColor( p1 ) | | +| SeekBar.GetWidth()                                                                                                                                                                                                                                                                                                                                                       
-|SeekBar.SetBackGradient( p1,p2,p3,p4,p5,p6,p7 ) | | +| SeekBar.Release()                                                                                                                                                                                                                                                                                                                                                        
-|SeekBar.SetBackGradientRadial( p1,p2,p3,p4,p5,p6,p7 ) | | +| SeekBar.SetBackColor( color                                   Sets the background color of the seekbar to the given color. The color is defined by a 6 or 8 character hexidecimal color code string, e.g. "#99A055" or "#A099A055". The string has the format #RRGGBB or #AARRGGBB, where A is the alpha (transparency) channel, R is red, G is green, and B is blue.  
-|SeekBar.SetBackground( p1,p2 ) | | +| SeekBar.SetBackGradient( color1,color2,color3,p4,p5,p6,p7 )                                                                                                                                                                                                                                                                                                              
-|SeekBar.SetMargins( left,top,right,bottom ) | | +| SeekBar.SetBackGradientRadial( x,y,r,color1,color2,color3,p7 )                                                                                                                                                                                                                                                                                                           
-|SeekBar.SetMaxRate( p1 ) | | +| SeekBar.SetBackground( imagefile,options                                                                                                                                                                                                                                                                                                                               
-|SeekBar.SetOnTouch( callback ) | | +| SeekBar.SetMargins( left,top,right,bottom )                                                                                                                                                                                                                                                                                                                              
-|SeekBar.SetPadding( p1,p2,p3,p4 ) | | +| SeekBar.SetMaxRate( ms                                        Sets the maximum rate at which the OnTouch event can occur. At least ms milliseconds must pass between each occurance of the OnTouch event. If not set, ms defaults to 0.                                                                                                                                
-|SeekBar.SetPosition( p1,p2,p3,p4 ) | | +| SeekBar.SetOnTouch( callback )                                                                                                                                                                                                                                                                                                                                           
-|SeekBar.SetRange( p1 ) | | +| SeekBar.SetPadding( width,height,top,bottom                                                                                                                                                                                                                                                                                                                            
-|SeekBar.SetScale( x,y ) | | +| SeekBar.SetPosition( left,top,width,height                                                                                                                                                                                                                                                                                                                             
-|SeekBar.SetSize( p1,p2 ) | | +| SeekBar.SetRange( range                                       Sets the maximum value of the seekbar. The minimum value is 0.                                                                                                                                                                                                                                           
-|SeekBar.SetValue( p1 ) | | +| SeekBar.SetScale( x,y )                                         Multiplies the horizontal and vertical size of the seekbar by x and y respectively.                                                                                                                                                                                                                      
-|SeekBar.SetVisibility( p1 ) | |+| SeekBar.SetSize( width,height                                                                                                                                                                                                                                                                                                                                          
 +| SeekBar.SetValue( value                                       Sets the value of the seekbar to the given value. If the given value is outside the seekbar's range, the seekbar value is set to the min or max value, whichever is closer.                                                                                                                              
 +| SeekBar.SetVisibility( HideShow                                                                                                                                                                                                                                                                                                                                        | 
 + 
 +=====Sample===== 
 +[[tips_tricks:seekbar_setontouchup|Seekbar SetOnTouchUp workaround]]
built_in/seekbars.1417786754.txt.gz · Last modified: 2014/12/05 21:39 (external edit)