1
0
Fork 0

TabWidget: make setCurrentTab lazy

This commit is contained in:
James Turner 2023-01-05 14:39:43 +00:00
parent 333321556f
commit b359fc88cb

View file

@ -165,14 +165,17 @@ gui.widgets.TabWidget = {
die("tab with id '" ~ id ~ "' does not exist");
}
if (me._currentTabId == id) {
return; # no need to do anything
}
if (me._currentTabId) {
me._tabButtons[me._currentTabId].setSelected(0);
}
me._tabButtons[id].setSelected();
foreach (var tabid; keys(me._tabs)) {
me._tabs[tabid].setVisible(0);
me._tabs[tabid].setVisible(tabid == id);
}
me._tabs[id].setVisible(1);
me._currentTabId = id;
me._currentTab = me._tabs[id];