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

This subforum contains all the issues which we already resolved.
Oarc
Fast Inserter
Fast Inserter
Posts: 122
Joined: Sun Sep 18, 2016 2:04 pm
Contact:

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

Post 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 601 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 601 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.
User avatar
raiguard
Factorio Staff
Factorio Staff
Posts: 669
Joined: Wed Dec 13, 2017 8:29 pm
Contact:

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

Post 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.
Don't forget, you're here forever.
Post Reply

Return to “Resolved Problems and Bugs”