Titanium.UI.createTextArea - How to disable touch events for a text area

You must Login before you can answer or comment on any questions.

I have the following text area...

var captionText = Titanium.UI.createTextArea({
    value: unescapeHTML(win.objProp1[win.galleryNumber].titles[0]),
    height:80,
    width:320,
    bottom:42,
    font:{fontSize:12,fontFamily:'Helvetica Neue', fontWeight:'bold'},
    color:'#fff',
    textAlign:'left',
    paddingLeft:20,
    opacity:0.7,
    backgroundColor:'#000',
    editable:false,
    touchEnabled: false,
});
How do I stop the user from

  1. Scrolling the text area and displaying scrollbars.
  2. Being able to select the text for copying and pasting via double tapping the text.

I've tried overriding the following events which doesn't work.

captionText.addEventListener('focus', function(e)
{
    //do nothing
    e.preventDefault();
    alert('test');
});
 
captionText.addEventListener("touchmove", function(e)
{
    e.preventDefault();
    alert('test2');
});
 
 
captionText.addEventListener("doubletap", function(e)
{
    e.preventDefault();
    alert('test3');
});
Thanks for any help.

— asked 4 years ago by Phi Chong
0 Comments

1 Answer

Hey Phi,

Have you tried using a label instead of a textarea? It's able to do multirow and isn't selectable by the user, so it might be a better option here.

Your Answer

Think you can help? Login to answer this question!