ItemDeselected: function (sender, args: PP.TabControlArgs);
sender. Event source.
args. Event information.
The ItemDeselected event occurs on closing a tab.
Only one tab can be selected (opened) in the component at the same time. The tab opens on clicking on the heading. The tab closes when another tab is selected.
To execute the example, connect the PP.js components library and the PP.css visual styles table. Create the TabControl component. Add a handler for the event ItemDeselected:
//Create the TabControl component: var tabcontrol = new PP.Ui.TabControl({ ParentNode: document.getElementById("tabcont1"), Width: 250, Height: 50, //Path to the images folder: ImagePath: "img" }); //Add tabs to the TabControl component: tabcontrol.addItem(new PP.Ui.TabItem({ Position: PP.LTRB.Top, Caption: "First tab", Content: "Content 1" })); tabcontrol.addItem(new PP.Ui.TabItem({ Position: PP.LTRB.Top, Caption: "Second tab", Content: "Content 2" })); //Add the ItemDeselected event handler tabcontrol.ItemDeselected.add(function (sender, args) { alert("The " + tabcontrol.getItems()[tabcontrol.getSelectedIndex()].getCaption() + " was closed"); });
After executing the example the following message pops up on closing a tab: The (heading of the closed tab) was closed.
See also: