Titanium Community Questions & Answer Archive

We felt that 6+ years of knowledge should not die so this is the Titanium Community Questions & Answer Archive

Scrollable view (with touch disabled): buttons inside won't fire

Hi people,

So I have a scrollable view, which I dynamically add views to. Inside these views, I have a button that should slide the view to the left or to the right.

Now what seems to be odd is, whenever I have the touchEnabled property of the Scrollable view instance, set to false, my buttons inside the dynamically created views are not clickable.

With touchEnabled set to true, the buttons are clickable, but the doClick function does somehow not fire off the alert box.

Here's a stripped down version of my code:

var scrollView = Titanium.UI.createScrollableView({
    touchEnabled: false,
    showPagingControl: false

function doClick(e) {
    var btn = e.source;
    alert("  -- clicked button: " + btn);

for ... {
    var newView = Ti.UI.createView();
    var right = Titanium.UI.createButton({
        click: doClick,
        left: 10,
        width: 20



Any help would be appreciated!

— asked September 29th 2010 by Daan Doen
  • button
  • iphone
  • mobile
  • scrollableview
  • scrollview
  • Anyone??

    — commented September 30th 2010 by Daan Doen
  • I'm having the same issue. Help please?

    — commented October 20th 2010 by Rick Martinez
  • I'm having a similar issue. My button sometimes works and sometimes doesn't.

    — commented October 23rd 2010 by Sammy Shreibati

2 Answers

  • I think the views overlap eachother and thats why the buttons can't fire.
    Try adding "backgroundColor" to see which view overlaps the other.

    — answered November 10th 2010 by Michael Ionita
  • I don't think you can add an event listener to a control in the constructor/factory function (if you can, it's not documented anywhere I see). I put together the following app.js example which shows how to do pretty much exactly what you're trying to do, except I omit touchEnabled:false which causes the entire visible view in the scrollable view to be unresponsive.

    — answered November 10th 2010 by Kevin Whinnery
The ownership of individual contributions to this community generated content is retained by the authors of their contributions.
All trademarks remain the property of the respective owner.