Changing tab from code - active and inactive

Hi I have few tabs - dashboard and login.
They are define in main.lua
When you press the login tab it takes you to the login scene. Login tab is now active. After successful login I would like to redirected
to the dashboard scene with dashboard tab active.how do I deactive login tab? I will do the same thing for dashboard tab. If you are not logged in go to login scene and make login scene active and deactive dashboard scene.

I can set active tab by tabbar:setselected. But there is no option for deselecting tabs.

Any hints or help will be great

Hello @davidhagen,

The tabBar should automatically adjust the active tab when you click on it. Likewise, using “:setSelected()” should highlight the specified tab while also de-selecting the others. If this isn’t happening, there may be some issue in how you’re referencing the tabBar. Remember that it matters hugely where you set up the tab bar, and how you provide a reference to it between scenes.

Take care,

Brent

Thank you Brent. I went through the code again and I found there were logical issues in the code. tabbar:setSelected indeed deselect other tabs set the passed tab index active.

Hello @davidhagen,

The tabBar should automatically adjust the active tab when you click on it. Likewise, using “:setSelected()” should highlight the specified tab while also de-selecting the others. If this isn’t happening, there may be some issue in how you’re referencing the tabBar. Remember that it matters hugely where you set up the tab bar, and how you provide a reference to it between scenes.

Take care,

Brent

Thank you Brent. I went through the code again and I found there were logical issues in the code. tabbar:setSelected indeed deselect other tabs set the passed tab index active.