User Tools

Site Tools


sample_code:layout_children

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
sample_code:layout_children [2014/12/01 06:32]
stevegarman
sample_code:layout_children [2014/12/28 17:49]
stevegarman add clearLayout
Line 1: Line 1:
 ====== Layout Children ====== ====== Layout Children ======
-DroidScript's [[built_in:layouts|Layout]] comes complete with methods ChildToFront and GetChildOrder but some people seem to think it is missing a couple of methods, so I offer these functions in the hopr that they may be useful.+DroidScript's [[built_in:layouts|Layout]] comes complete with methods ChildToFront and GetChildOrder but some people seem to think it is missing a couple of methods, so I offer these functions in the hope that they may be useful.
 ===== ChildToBack ===== ===== ChildToBack =====
 <code javascript childToBack.js> <code javascript childToBack.js>
Line 42: Line 42:
   return children;    return children; 
  
 +</code>
 +===== clearLayout =====
 +<code JavaScript clearlayout.js>
 +function clearLayout(layt)
 +{
 +  //takes a layout as an argument 
 +  var obj, order; 
 +  //loop through all controls 
 +  for (var id in _map) 
 +  { 
 +      obj = _map[id] 
 +      //check if control is on our layout 
 +      order = layt.GetChildOrder( obj ); 
 +      if( order > -1 ) 
 +      { 
 +          //got one! 
 +          layt.DestroyChild( obj ); 
 +      } 
 +   }
 +
 </code> </code>
 ===== Sample app ===== ===== Sample app =====
sample_code/layout_children.txt · Last modified: 2014/12/29 02:20 (external edit)