Search
TabControl.selectedIndex Property
See Also
 






Gets the index of the currently selected tab page.

Namespace: MindFusion.Common.UI
File: TabControl.js

 Syntax

JavaScript  Copy Code

get selectedIndex() {}

 Property Value

Number. The index of the selected TabPage.

 Example

The following code creates a new instance of the TabControl class and handles its tabHeaderClick event.

JavaScript  Copy Code

// create a new instance of the TabControl control
var tabControl = new ui.TabControl(document.getElementById("tabcontrol"));
tabControl.width = tabControl.height = new ui.Unit(100, ui.UnitType.Percent);
tabControl.theme = "standard";
tabControl.tabHeaderClick.addEventListener(handleTabHeaderClick);

=======================

function handleTabHeaderClick(sender, args)
{
 if (sender.title == "+")
 {
  addEmptyPage();
 }
 else if (sender.data == -1)
 {
  if (tabControl.selectedIndex > 2)
   tabControl.selectedIndex -= 1;
 }
 else if (sender.data == 1)
 {
  if (tabControl.selectedIndex < tabControl.items.count() - 2)
   tabControl.selectedIndex += 1;
 }
}

 See Also