views:

23

answers:

0

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({
    currentPage:1,
    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({
        image:'ui/right.png',
        click: doClick,
        left: 10,
        width: 20
    });

    newView.add(right);

    scrollView.addView(newView);
}