Disabling a tab within a TabGroup

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

Im trying to get the first and last tab of the TabGroup to be disable so I can give them custom functionality instead of switching the view. I have tried touchEnabled = false and a handfull of other stuff and I'm cant seem to get anything to work ... any ideas?

function TabView() {
 
    var viewOne = require('ui/common/...');
    var viewTwo = require('ui/common/...');
    var viewTree = require('ui/common/...');
    var self = Ti.UI.createTabGroup();
 
    var tab1 = Titanium.UI.createTab({
        title : 'Tab 1'
    });
 
    var firstView = viewOne();
    var tab2 = Ti.UI.createTab({
        title: L('firstView'),
        icon: '/images/...',
        window: firstView,
        active:true
    });
    firstView.containingTab = tab2;
 
    var secondView = viewTwo();
    var tab3 = Ti.UI.createTab({
        title: L('secondView'),
        icon: '/images/...',
        window: secondView
    });
    secondView.containingTab = tab3;
 
    var thirdView = viewTree();
    var tab4 = Ti.UI.createTab({
        title: L('Map'),
        icon: '/images/....',
        window: thirdView
    });
    thirdView.containingTab = tab4;
 
    var tab5 = Titanium.UI.createTab({
        title : 'Tab 5'
    });
 
    var tabArray = [tab1, tab2, tab3, tab4, tab5];
    for ( i = 0; i < tabArray.length; i++) {
        self.addTab(tabArray[i]);
    }
 
    return self;
}
 
module.exports = TabView;

2 Answers

The only way I see this is to focus right away back to the active tab and execute your custom code.

— answered 8 months ago by Dan Tamas
answer permalink
1 Comment
  • Thx for the idea Dan. I did try that but it seemed to much of a hack . I really just want to get it disabled

    — commented 8 months ago by Jason Groulx

Your Answer

Think you can help? Login to answer this question!