All visible controls and even layouts have a GetType() method which returns a string indicating the type of the control.
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.
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()); }