TabBar Background Image wont Change Back to Default

I am not sure if this is one of the intended function but when I try to setSelected for tabbar into a 0 or nil, I was hoping that it will unselect everything in the tab. However, all label color change back to default value except for the selected background. Example code:

--Example from Corona Doc: https://docs.coronalabs.com/api/library/widget/newTabBar.html local widget = require( "widget" ) local function handleTabBarEvent( event ) print( event.target.id ) end local options = { frames = { { x=4, y=0, width=24, height=120 }, { x=32, y=0, width=40, height=120 }, { x=72, y=0, width=40, height=120 }, { x=112, y=0, width=40, height=120 }, { x=152, y=0, width=72, height=120 }, { x=224, y=0, width=72, height=120 } }, sheetContentWidth = 296, sheetContentHeight = 120 } local tabBarSheet = graphics.newImageSheet( "widget-tabbar-sheet.png", options ) -- Configure the tab buttons to appear within the bar local tabButtons = { { defaultFrame = 5, overFrame = 6, label = "Tab1", id = "tab1", selected = true, size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent }, { defaultFrame = 5, overFrame = 6, label = "Tab2", id = "tab2", size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent }, { defaultFrame = 5, overFrame = 6, label = "Tab3", id = "tab3", size = 16, labelYOffset = -8, labelColor = { default={ 1 }, over={ 0 } }, onPress = handleTabBarEvent } } local tabBar = widget.newTabBar( { sheet = tabBarSheet, left = 0, top = display.contentHeight-120, width = 580, height = 120, backgroundFrame = 1, tabSelectedLeftFrame = 2, tabSelectedMiddleFrame = 3, tabSelectedRightFrame = 4, tabSelectedFrameWidth = 40, tabSelectedFrameHeight = 120, buttons = tabButtons } ) --When I run this line, all label changed back to default color except for tabSelected background image that still remains tabBar:setSelected( 0 ) --or tabBar:setSelected( nil )

I would like to know if this is actually not the intended function or it is really a bug with the background?

I am using Corona Build: 2016.2906

I just did a quick test and setting the tab to 0 worked for me. My app isn’t using image sheets though. I looked at the code and it should be working like it should.

Rob

Hmm thats weird, everything did change back to default but only for this 3:

tabSelectedLeftFrame = 2,
tabSelectedMiddleFrame = 3,
tabSelectedRightFrame = 4,

Even when I didnt set customSprite for the frames, I still see that only the selected tab image will not disappear.
 

Below is some screenshot to my problem:
The “First Tab Selected.png” shows what happen when I select the first tab.

The “After Setting to 0.png” shows what happen when I set tabBar:setSelected( 0 )
As the image shows the selected background still linger in the tab although the label had already been change back to default color.

I believe it’s by design that you cannot turn off all the tabs. The reason it worked for me is my selected images are all white which is the same color as the un-selected tabs. I just saw the icon and text change color which works as you’ve noted when trying to set the image. But looking at the code, setting the selected button to a non-existent button may put the still selected button into an odd state since it’s supposed to be selected.

Let me talk with Engineering.

I just did a quick test and setting the tab to 0 worked for me. My app isn’t using image sheets though. I looked at the code and it should be working like it should.

Rob

Hmm thats weird, everything did change back to default but only for this 3:

tabSelectedLeftFrame = 2,
tabSelectedMiddleFrame = 3,
tabSelectedRightFrame = 4,

Even when I didnt set customSprite for the frames, I still see that only the selected tab image will not disappear.
 

Below is some screenshot to my problem:
The “First Tab Selected.png” shows what happen when I select the first tab.

The “After Setting to 0.png” shows what happen when I set tabBar:setSelected( 0 )
As the image shows the selected background still linger in the tab although the label had already been change back to default color.

I believe it’s by design that you cannot turn off all the tabs. The reason it worked for me is my selected images are all white which is the same color as the un-selected tabs. I just saw the icon and text change color which works as you’ve noted when trying to set the image. But looking at the code, setting the selected button to a non-existent button may put the still selected button into an odd state since it’s supposed to be selected.

Let me talk with Engineering.