Titanium Community Questions & Answer Archive

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

How to show selected buttonBar

Hi

I am wanting to show the selected button in a buttonBar after the user clicks on one of the button options. So when they select a button it becomes disabled, and when they select another button it becomes disabled and the other button re-enabled.

var bb1 = Titanium.UI.createButtonBar({
    labels:['10', '20', '30', '40', '50', '100'],
    backgroundColor:'#336699',
    top:75,
    style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
    height:35,
    width:300
});
bb1.addEventListener('click', function(e) {
    // Show selected button
        // and re-enable other previous disabled button

});

Could I please have some help on this :-)

Cheers
Jamesy

— asked June 30th 2010 by Richard James
  • buttonbar
  • disable
  • enable
0 Comments

1 Answer

  • Use a tabbedbar instead of a buttonbar. That will allow you to show which button is selected.

    var tb1 = Titanium.UI.createTabbedBar({
    labels:['One', 'Two', 'Three'],
    backgroundColor:'#336699',
    top:50,
    style:Titanium.UI.iPhone.SystemButtonStyle.BAR,
    height:25,
    width:200,
    index:2
    });

    — answered August 19th 2010 by Brent Phillips
    permalink
    1 Comment
    • Thank you, nice answer.

      — commented April 1st 2014 by Srikanth P
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.