Trying to link to URLs from a createButtonBar
Hello
I am trying to create links from buttons in a "createButtonBar" to different views . . . I am stuck.
here is code:
//
// TOOLBAR
// 
var bb2 = Titanium.UI.createButtonBar({
    labels:['Current Temps', 'Doppler', 'Satellite'],
    backgroundColor:'#333333',
    BarColor:'#000000',
    index:0
});
var flexSpace = Titanium.UI.createButton({
    systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
});
win.setToolbar([flexSpace,bb2,flexSpace]);
bb2.addEventListener('click',function(e) 
{
    // handle tableview click events
    var idx = e.index;
    switch(idx)
    {
        case 0:Titanium.UI.createView({url:'Current.js',})
        case 1:Titanium.UI.createView({url:'satellite.js',})
        case 2:Titanium.UI.createView({url:'doppler.js',})
    }       
});
Thanks
b2e
3 Answers
- 
				
					you are just creating views. what do you want to do with them? the code above just creates them but does not do anything with them. 
- 
				
					Nolan 
 Thanks for your help . . . I am looking into buying "Titanium Professional Support" for the year.I am trying to click on a buttonbar button and refresh the view with another view . . . in this case another image view . . . below is code that I am currently working on . . . 
 var win = Titanium.UI.currentWindow Titanium.UI.currentWindow.setBarColor('#000'); var imageView = Titanium.UI.createImageView({ 
 url:'http://www.wusa9.com/weather/currents/7day.jpg',
 top:5,
 width:420,
 height:236
 });win.add(imageView); var l = Titanium.UI.createLabel({ 
 text:'WUSA9 7 Day Forecast',
 bottom:30,
 color:'#999',
 height:20,
 width:300,
 textAlign:'center'
 });
 win.add(l);// 
 // TOOLBAR
 //
 var bb2 = Titanium.UI.createButtonBar({
 labels:['Current Temps', 'Doppler', 'Satellite'],
 backgroundColor:'#333333',
 BarColor:'#000000',
 index:0
 });
 var flexSpace = Titanium.UI.createButton({
 systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
 });win.setToolbar([flexSpace,bb2,flexSpace]); var state = 0; 
 bb2.addEventListener('click', function(e)
 {
 var idx = e.index;
 switch(idx)
 {
 case 0:
 {
 Titanium.UI.createView({url:'Current.js'})
 Titanium.UI.currentTab.open(win,{animated:true})
 }case 1: { Titanium.UI.createView({url:'doppler.js'}) Titanium.UI.currentTab.open(win,{animated:true}) } case 2: { Titanium.UI.createView({url:'satellight.js'}) Titanium.UI.currentTab.open(win,{animated:true}) } }}); Thanks in advance. I am hoping to have funds for "Titanium Professional" soon . . . b2e 
- 
				
					Nolan 
 Thanks for your help . . . I am looking into buying "Titanium Professional Support" for the year.I am trying to click on a buttonbar button and refresh the view with another view . . . in this case another image view . . . below is code that I am currently working on . . . 
 var win = Titanium.UI.currentWindow Titanium.UI.currentWindow.setBarColor('#000'); var imageView = Titanium.UI.createImageView({ 
 url:'http://www.wusa9.com/weather/currents/7day.jpg',
 top:5,
 width:420,
 height:236
 });win.add(imageView); var l = Titanium.UI.createLabel({ 
 text:'WUSA9 7 Day Forecast',
 bottom:30,
 color:'#999',
 height:20,
 width:300,
 textAlign:'center'
 });
 win.add(l);// 
 // TOOLBAR
 //
 var bb2 = Titanium.UI.createButtonBar({
 labels:['Current Temps', 'Doppler', 'Satellite'],
 backgroundColor:'#333333',
 BarColor:'#000000',
 index:0
 });
 var flexSpace = Titanium.UI.createButton({
 systemButton:Titanium.UI.iPhone.SystemButton.FLEXIBLE_SPACE
 });win.setToolbar([flexSpace,bb2,flexSpace]); var state = 0; 
 bb2.addEventListener('click', function(e)
 {
 var idx = e.index;
 switch(idx)
 {
 case 0:
 {
 Titanium.UI.createView({url:'Current.js'})
 Titanium.UI.currentTab.open(win,{animated:true})
 }case 1: { Titanium.UI.createView({url:'doppler.js'}) Titanium.UI.currentTab.open(win,{animated:true}) } case 2: { Titanium.UI.createView({url:'satellight.js'}) Titanium.UI.currentTab.open(win,{animated:true}) } }}); Thanks in advance. I am hoping to have funds for "Titanium Professional" soon . . . b2e