/// <summary>Close a tab.</summary> /// <param name="o">A widget appearing on the tab</param> public void CloseTabContaining(object o) { Notebook notebook = null; string tabText = null; int tabPage = GetTabOfWidget(o, ref notebook, ref tabText); if (tabPage > 0) { TabClosingEventArgs args = new TabClosingEventArgs(); if (TabClosing != null) { args.LeftTabControl = IsControlOnLeft(o); args.Name = tabText; args.Index = tabPage; TabClosing.Invoke(this, args); } } }
/// <summary>User is closing a tab.</summary> private void OnCloseTabClick2(object sender, EventArgs e) { TabClosingEventArgs args = new TabClosingEventArgs(); args.LeftTabControl = false; if (TabClosing != null) { args.Name = tabControl2.SelectedTab.Text; args.Index = tabControl2.SelectedIndex; TabClosing.Invoke(this, args); } if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText) { tabControl2.TabPages.Remove(tabControl2.SelectedTab); } }
public void on_eventbox1_button_press_event(object o, ButtonPressEventArgs e) { if (e.Event.Button == 2) { Notebook notebook = null; string tabText = null; int tabPage = GetTabOfWidget(o, ref notebook, ref tabText); if (tabPage > -1) notebook.CurrentPage = tabPage; if (tabPage > 0) { TabClosingEventArgs args = new TabClosingEventArgs(); if (TabClosing != null) { args.LeftTabControl = IsControlOnLeft(o); args.Name = tabText; args.Index = tabPage; TabClosing.Invoke(this, args); } if (args.AllowClose) notebook.RemovePage(tabPage); } } }
/// <summary>Close a tab.</summary> /// <param name="o">A widget appearing on the tab</param> public void CloseTabContaining(object o) { Notebook notebook = null; string tabText = null; int tabPage = GetTabOfWidget(o, ref notebook, ref tabText); if (tabPage > 0) { TabClosingEventArgs args = new TabClosingEventArgs(); if (TabClosing != null) { args.LeftTabControl = IsControlOnLeft(o); args.Name = tabText; args.Index = tabPage; TabClosing.Invoke(this, args); } if (args.AllowClose) notebook.RemovePage(tabPage); } }
/// <summary>User is closing a tab.</summary> private void OnCloseTabClick2(object sender, EventArgs e) { TabClosingEventArgs args = new TabClosingEventArgs(); args.LeftTabControl = false; if (TabClosing != null) { args.Name = tabControl2.SelectedTab.Text; args.Index = tabControl2.SelectedIndex; TabClosing.Invoke(this, args); } if (args.AllowClose && tabControl2.SelectedTab.Text != indexTabText) tabControl2.TabPages.Remove(tabControl2.SelectedTab); }