public void AddTab(Tab tab)
{
- tab.parent = this;
+ if(tab.parent != this)
+ {
+ tab.parent = this;
+ return;
+ }
tab.autoCreate = false;
tab.id = numTabs;
- tab.button = TabButton
+ if(!tab.button)
{
- parent = tabButtons,
- master = this, stayDown = true,
- text = tab.text, id = (int64)(intptr)tab, NotifyClicked = NotifyClicked,
- tab = tab,
- background = background;
- };
- incref tab.button;
+ tab.button = TabButton
+ {
+ parent = tabButtons,
+ master = this, stayDown = true,
+ text = tab.text, id = (int64)(intptr)tab, NotifyClicked = NotifyClicked,
+ tab = tab,
+ background = background;
+ };
+ incref tab.button;
+ }
if(created)
{
{
Window child;
Tab fallbackTab = null;
- tab.parent = null;
+ // tab.parent = null;
for(child = tabButtons.children.first; child; child = child.next)
{
if(child._class == class(TabButton))
if(button.id == (int64)(intptr)tab)
{
if(button.created)
+ {
button.Destroy(0);
+ numTabs--;
+ }
break;
}
else
fallbackTab = tabButtons.children.first ? ((TabButton)tabButtons.children.first).tab : null;
if(fallbackTab)
fallbackTab.SelectTab();
+ else
+ curTab = null;
/*curTab = fallbackTab;
curButton = curTab.button;
curButton.checked = true;
curTab.autoCreate = true;*/
}
- numTabs--;
}
~TabControl()