Page 1 of 1

[Raiguard] [1.1.110] Removing a tab unexpectedly combines tab content

Posted: Sun Oct 13, 2024 1:15 am
by Oarc
Test setup:

Code: Select all

local tabbed_pane = game.player.gui.top.add{type="tabbed-pane", name="tabbed_pane"}
local tab1 = tabbed_pane.add{type="tab", caption="Tab 1", name="tab_1"}
local tab2 = tabbed_pane.add{type="tab", caption="Tab 2", name="tab_2"}
local tab3 = tabbed_pane.add{type="tab", caption="Tab 3", name="tab_3"}
local label1 = tabbed_pane.add{type="label", caption="Label 1", name="lbl1"}
local label2 = tabbed_pane.add{type="label", caption="Label 2", name="lbl2"}
local label3 = tabbed_pane.add{type="label", caption="Label 3", name="lbl3"}
tabbed_pane.add_tab(tab1, label1)
tabbed_pane.add_tab(tab2, label2)
tabbed_pane.add_tab(tab3, label3)
Select Tab 2:
10-12-2024, 21-09-27.png
10-12-2024, 21-09-27.png (4.43 KiB) Viewed 603 times
Delete tab 3:

Code: Select all

game.player.gui.top.tabbed_pane.remove_tab(game.player.gui.top.tabbed_pane.tab_3)
Result:
10-12-2024, 21-10-26.png
10-12-2024, 21-10-26.png (3.99 KiB) Viewed 603 times
If you check the selected tab it reports this:

Code: Select all

game.player.gui.top.tabbed_pane.selected_tab_index = 2
So setting the selected tab to 2 does nothing, visually it stays the same.

If you click on the currently selected tab, it doesn't clear the issue, but it does update the selected_tab_index.
If you click on the tab 2, it then clears the issue and things are working again.

Re: [Raiguard] [1.1.110] Removing a tab unexpectedly combines tab content

Posted: Tue Jan 21, 2025 10:51 pm
by raiguard
Thanks for the report, this has been fixed for the 2.0.33.

Removing a tab will auto-update the selected_tab_index, and I also made the behavior more intuitive; it will only decrement the index by 1 if the removed tab is <= the selected tab, otherwise it will leave it untouched.