DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


tips_tricks:toggle_visibility

Differences

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

Link to this comparison view

tips_tricks:toggle_visibility [2015/04/06 08:46] (current)
stevegarman created
Line 1: Line 1:
 +====== Toggle Visibility ======
 +Do you want a button to hide a layout or control, then the next time to show it again?
 +
 +Call this function.
 +<code JavaScript togglevis.js>​
 +function toggleVisibility(control,​gone)
 +//​param1 is a control or layout
 +//​param2 true=Gone,​false=Hide (default false)
 +{
 +   if(control.GetVisibility()=="​Show"​)
 +   {
 +       control.SetVisibility(gone?"​Gone":"​Hide"​)
 +   }
 +   else
 +   {
 +       control.SetVisibility("​Show"​)
 +   }
 +}
 +</​code>​
 +===== Note =====
 +If you pass **true** as the second parameter, when the control is hidden, it will be set to **Gone**.\\
 +If the second parameter is missing or **false** the visibility mode will be **Hide**
  
tips_tricks/toggle_visibility.txt · Last modified: 2015/04/06 08:46 by stevegarman