User Tools

Site Tools


built_in:layouts

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:layouts [2015/03/07 18:29]
octazid completed
built_in:layouts [2018/12/08 02:02] (current)
Line 10: Line 10:
  
 Create layouts using the **CreateLayout** function of the [[built_in:app|app]] object: Create layouts using the **CreateLayout** function of the [[built_in:app|app]] object:
-<code> lay.AddChildobject );</code>+<code> lay = app.CreateLayouttype, options );</code>
  
 Add child objects to a layout using the **AddChild** function of the layout object. Add child objects to a layout using the **AddChild** function of the layout object.
-<code> lay = app.CreateLayouttype, options );</code>+<code> lay.AddChildobject );</code>
  
-The alignment of child objects within a layout can be set by adding the options **"Left"**, **"Right"**, **"Bottom"** and **"VCenter"**, by default objects will be aligned **"Top,Center"**. Remove layouts using the **RemoveLayout** function of the app object:+The alignment of child objects within a layout can be set by adding the options **"Left"**, **"Right"**, **"Bottom"** and **"VCenter"**, by default objects will be aligned **"Top,Center"**.\\  
 +Remove layouts using the **RemoveLayout** function of the app object:
 <code> app.RemoveLayout( lay );</code> <code> app.RemoveLayout( lay );</code>
  
Line 131: Line 132:
 Absolute layouts allows you to add controls in any position relative to the width and height of your screen from 0 to 1. Absolute layouts ignore all alignment options and allow the absolute positioning of controls by calling the **SetPosition** and **SetSize** functions of each of the child objects. This type of layout is rarely used and you are encouraged use Linear layouts for most of your programs. Absolute layouts allows you to add controls in any position relative to the width and height of your screen from 0 to 1. Absolute layouts ignore all alignment options and allow the absolute positioning of controls by calling the **SetPosition** and **SetSize** functions of each of the child objects. This type of layout is rarely used and you are encouraged use Linear layouts for most of your programs.
  
 +<code javascript>
 +function OnStart()
 +{
 +  lay = app.CreateLayout( "Absolute" );
 +  btn = app.CreateButton( "Press Me" );
 +  btn.SetPosition( 0.4,0.4 );
 +  btn.SetOnTouch( btn_OnTouch );
 +  lay.AddChild( btn );
 +
 +  app.AddLayout( lay );
 +}
 +
 +function btn_OnTouch()
 +{
 +  app.Alert( "This is a Absolute Layout!" );
 +}
 +</code>
 =====Padding and Margins===== =====Padding and Margins=====
 In Linear and Frame Layouts, you can use the **SetPadding** function of a layout to keep a layout's child objects away from the edges of the layout: In Linear and Frame Layouts, you can use the **SetPadding** function of a layout to keep a layout's child objects away from the edges of the layout:
Line 154: Line 172:
  
 ===== Methods ===== ===== Methods =====
-^Method ^Description ^ +^ Method                                                         ^ Description                                                                                                                                                                                                                                        
-|Layout.AddChild( child,order ) | | +| Layout.AddChild( child,order )                                 child is the object to add to the Layout. Order is the rang option to make an object behind an other Object.                                                                                                                                       
-|Layout.Animate( type,callback ) |known types: <code>SlideFromLeft +| Layout.Animate( type, callback, time                                | known types: SlideFromLeft,SlideFromRight,SlideFromTop,SlideFromBottom,SlideToLeft,SlideToRight,SlideToTop,SlideToBottom,ScaleFromLeft, ScaleFromRight,ScaleFromTop, ScaleFromBottom, ScaleToLeft, ScaleToRight, ScaleToTop,ScaleToBottom,FadeIn,FadeOut,Flip
-ScaleFromLeft +| Layout.ChildToFront( child )                                                                                                                                                                                                                                                                                      
-SlideToLeft +| Layout.Destroy()                                               This function Destroys a Layout forever.                                                                                                                                                                                                           
-ScaleToLeft +| Layout.DestroyChild( child )                                   This function Destroys a child of a Layout forever.                                                                                                                                                                                                
-SlideFromRight +| Layout.GetAbsHeight()                                                                                                                                                                                                                                                                                             
-ScaleFromRight +| Layout.GetAbsWidth()                                                                                                                                                                                                                                                                                              
-SlideToRight +| Layout.GetChildOrder( child )                                  This function returns the rang of an Object of a Layout.                                                                                                                                                                                           
-ScaleToRight +| Layout.GetHeight()                                             This returns the Height of an Layout.                                                                                                                                                                                                              
-SlideFromTop +| Layout.GetPosition()                                           This returns the Position of an Layout.                                                                                                                                                                                                            
-ScaleFromTop +| Layout.GetType()                                               This returns the string "Layout"                                                                                                                                                      
-SlideToTop +| Layout.GetVisibility()                                         This returns a Layout's visibility mode. “Hide”, “Show” or “Gone”                                                                                                                                                                                  
-ScaleToTop +| Layout.GetWidth()                                              This returns the Width of an Layout.                                                                                                        | 
-SlideFromBottom +| Layout.SetOnTouch( callback )           |Does not work in 'TouchThrough' mode               | 
-ScaleFromBottom +| Layout.SetOnTouchDown( callback )       |only OnTouchDown works when in 'TouchThrough' mode | 
-SlideToBottom +| Layout.SetOnTouchMove( callback )       |Does not work in 'TouchThrough' mode               | 
-ScaleToBottom</code> +| Layout.SetOnTouchUp( callback )         |Does not work in 'TouchThrough' mode               
-|Layout.ChildToFront( child ) | | +| Layout.Release()                                                              
-|Layout.Destroy() | | +| Layout.RemoveChild( child )                                    This removes a Child of an Layout, this Child can be added again with Layout.AddChild( child ).                                                                                                                                                    
-|Layout.DestroyChild( child ) | | +| Layout.SetBackColor( colorCode )                               This sets the Background Color of an Layout.                                                                                                                                                                                                       
-|Layout.GetAbsHeight() | | +| Layout.SetBackGradient( color1,color2,color3,p4,p5,p6,p7 )     This sets 3 Background Colors for the Layout which are splited at a Line between p4 and p5 or between p6 and p7.                                                                                                                                   
-|Layout.GetAbsWidth() | | +| Layout.SetBackGradientRadial( x,y,r,color1,color2,color3,p7 )                                                                                                                                                                                                                                                     
-|Layout.GetChildOrder( child ) | | +| Layout.SetBackground( imageFile, options )                     You can set an Image as the Background of an Layout ( Layout.SetBackground( "Img/test.png");). options is an optional string that can be “repeat”                                                                                                  
-|Layout.GetHeight() | | +| Layout.SetMargins( left,top,right,bottom )                                                                                                                                                                                                                                                                        
-|Layout.GetPosition() | | +| Layout.SetOrientation( orient )                                | "Portrait" or "Landscape"                                                                                                                                                                                                                          
-|Layout.GetType() | | +| Layout.SetPadding( left, top, right, bottom )                                                                                                                                                                                                                                                                     
-|Layout.GetVisibility() | | +| Layout.SetPosition( left, top, width, height )                                                                                                                                                                                                                                                                    
-|Layout.GetWidth() | | +| Layout.SetScale( x,y )                                                                                                                                                                                                                                                                                            
-|Layout.Release() | | +| Layout.SetSize( width, height )                                                                                                                                                                                                                                                                                   
-|Layout.RemoveChild( child ) | | +| Layout.SetTouchable( touchable )                                                                                                                                                                                                                                                                                  
-|Layout.SetBackColor( colorCode ) | | +| Layout.SetVisibility( visibility )                             | "Hide", "Show" or "Gone"                                                                                                                                                                                                                           |
-|Layout.SetBackGradient( color1,color2,color3,p4,p5,p6,p7 ) | | +
-|Layout.SetBackGradientRadial( x,y,r,color1,color2,color3,p7 ) | | +
-|Layout.SetBackground( imageFile, options ) |options is an optional string that can be “repeat” | +
-|Layout.SetMargins( left,top,right,bottom ) | | +
-|Layout.SetOrientation( orient ) |"Portrait" or "Landscape"+
-|Layout.SetPadding( left, top, right, bottom ) | | +
-|Layout.SetPosition( left, top, width, height ) | | +
-|Layout.SetScale( x,y ) | | +
-|Layout.SetSize( width, height ) | | +
-|Layout.SetTouchable( touchable ) | | +
-|Layout.SetVisibility( visibility ) | "Hide", "Show" or "Gone"| +
 ===== Options ===== ===== Options =====
 You can combine options too. Use the comma to seperate the options:  You can combine options too. Use the comma to seperate the options: 
built_in/layouts.1425752982.txt.gz · Last modified: 2015/03/08 02:29 (external edit)