DroidScript wiki

(was AndroidScript) unofficial documentation by the community

User Tools

Site Tools


built_in:gettype

Differences

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

Link to this comparison view

built_in:gettype [2015/09/12 07:32] (current)
stevegarman created
Line 1: Line 1:
 +====== GetType ====== 
 +All visible controls and even layouts have a GetType() method which returns a string indicating the type of the control. 
 +===== Sample code ===== 
 +This sample uses GetType to decide whether an OnTouch handler has been called by a Text or a TextEdit and only shows a pop-up once, either way. 
 +<code JavaScript GetType.js>​ 
 +function onTouch(ev) 
 +
 +    var type=this.GetType();​ 
 +    if(type=="​Text"​ &&​ ev.action=="​Up"​) 
 +       app.ShowPopup(this.GetText());​ 
 +    else if(type=="​TextEdit"​) 
 +      app.ShowPopup(this.GetText());​ 
 +
 +</​code>​
built_in/gettype.txt · Last modified: 2015/09/12 07:32 by stevegarman