private TDHTabCtl.TdhTabCtl _owner = null; // 1.0.002 #endregion #region Class Constructor (and Dispose) // public TdhTabPageControls(TDHControls.TDHTabCtl.TdhTabCtl owner) // : base((System.Windows.Forms.Control)owner) // // protected void Dispose( bool disposing ) // public TdhTabPageControls(TDHControls.TDHTabCtl.TdhTabCtl owner) // 1.0.002 : base((System.Windows.Forms.Control)owner) // 1.0.002 { // 1.0.002 Initialize_gblRunModeIs(); // Set [gblRunModeIs_DebugMode] and [gblRunModeIs_DesignMode] // 1.0.000 _owner = owner; // 1.0.002 } // 1.0.002
private void tdhTabCtl1_OnTabEvents(object sender, TDHControls.TDHTabCtl.TabEventArgs e) { switch (e.TabEvent) { case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.TabAdded: Console.WriteLine("Added="+ e.TabPage.Text); // TEST break; case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.TabAddRejected: Console.WriteLine("Add Rejected="+ e.TabPage.Text); // TEST //this.tabControl1.Controls.Add(e.TabPage); this.tabControl1.TabPages.Add(e.TabPage); break; case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.TabRemoved: Console.WriteLine("Closed="+ e.TabPage.Text); // TEST this.tabControl1.Controls.Add(e.TabPage); //this.tdhTabCtl1.Controls.Add(e.TabPage); //this.tdhTabCtl1.TabPages.Add(e.TabPage); break; case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.TabRenamed: Console.WriteLine("Renamed="+ e.TabPage.Text.Trim() // TEST //+" contains? "+ this.tdhTabCtl1.TabPages.Contains(e.TabPage).ToString() ); // TEST +" contains? "+ this.tdhTabCtl1.Controls.Contains(e.TabPage).ToString() ); // TEST break; case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.TabsReordered: // This "subevent" is not raised // if the [tdhTabCtl1.OnTabsReordered] eventhandler is assigned // It is raised for each TdhTabPage affected by the reorder Console.WriteLine("TdhTabPage reordered." // TEST +" OldInd="+ e.TabIndexOld.ToString() // TEST +" NewInd="+ e.TabIndexNew.ToString()); // TEST break; case TDHControls.TDHTabCtl.TabEventArgs.TabEvents.undefined: default: break; } }
private void tdhTabCtl1_OnTabsReordered(object sender, TDHControls.TDHTabCtl.TabsReorderedEventArgs e) { for (int idx = 0; idx < e.TabOrder_int.Length; idx++) { Console.WriteLine("TdhTabPage reordered." // TEST +" OldInd="+ e.TabOrder_int[idx].ToString() // TEST +" NewInd="+ idx.ToString() ); // TEST } }
} // 1.0.001 private void TabPage_Renamed(object sender, TDHControls.TDHTabCtl.TDHEditBox.EditEventArgs editArgs)// 1.0.001 { // 1.0.001 // This method finalizes the [.TabEvents.TabAdded] and [.TabEvents.TabRenamed] actions // 1.0.001 if( (this.cmnuTabRect_TabRect_Idx > -1) // 1.0.001 && (this.cmnuTabRect_TabRect_Idx < this.TabCount) // 1.0.001 ) // 1.0.001 { // 1.0.001 if( (this._OnTabEvents_RenameIsAdd) // Was the user adding a TabPage // 1.0.001 && !editArgs.EditAccepted) // and rejected the new TabPage? // 1.0.001 { // 1.0.001 #region Fire [.TabEvents.TabAddRejected] event to client? // Remove the new TabPage from [this.TabPages] // 1.0.001 System.Windows.Forms.TabPage theTabPage = this.TdhTabPages[cmnuTabRect_TabRect_Idx]; // 1.0.010 //this.TabPages.Remove(theTabPage); // 1.0.001 this.TdhTabPages.Remove(theTabPage); // 1.0.010 // If "New-TabPage" action is rejected; ensure that [this.SelectedIndex] doesn't change // 1.0.003 if( (this._thisSelectedIndex > -1) // 1.0.003 && (this._thisSelectedIndex < this.TabCount) // 1.0.003 && (this._thisSelectedIndex != this.SelectedIndex) // 1.0.003 ) // 1.0.003 { // 1.0.003 this.SelectedIndex = this._thisSelectedIndex; // 1.0.003 } // 1.0.003 // Fire [.TabEvents.TabAddRejected] event to client // 1.0.001 if (this.OnTabEvents != null) // 1.0.001 { // 1.0.001 this.OnTabEvents( // 1.0.001 this, // 1.0.001 new TDHTabCtl.TabEventArgs( // 1.0.001 theTabPage, // 1.0.001 TDHTabCtl.TabEventArgs.TabEvents.TabAddRejected // 1.0.001 ) // 1.0.001 ); // 1.0.001 } // 1.0.001 #endregion } // 1.0.001 else // The Add/Rename was accepted; Process it // 1.0.001 { // 1.0.001 #region Rename the TabPage (set [.Name] and [.Text]) if (editArgs.EditAccepted // 1.0.001 && (editArgs.EditText.Trim().Length > 0) // 1.0.001 ) // 1.0.001 { // 1.0.001 // //this.TabPages[cmnuTabRect_TabRect_Idx].Name = editArgs.EditText.Trim(); // 1.0.001 // this.TabPages[cmnuTabRect_TabRect_Idx].Text = editArgs.EditText.Trim(); // 1.0.001 //this.TdhTabPages[true, cmnuTabRect_TabRect_Idx].Name = editArgs.EditText.Trim(); // 1.0.010 this.TdhTabPages[true, cmnuTabRect_TabRect_Idx].Text = editArgs.EditText.Trim(); // 1.0.010 } // 1.0.001 this.cmnuTabRect_Built = false; // 1.0.001 #endregion #region Fire [.TabEvents.TabAdded] event to client? if (this._OnTabEvents_RenameIsAdd) // 1.0.001 { // 1.0.001 // Fire [.TabEvents.TabAdded] event to client // 1.0.001 if (this.OnTabEvents != null) // 1.0.001 { // 1.0.001 this.OnTabEvents( // 1.0.001 this, // 1.0.001 new TDHTabCtl.TabEventArgs( // 1.0.001 cmnuTabRect_TabRect_Idx, // 1.0.001 //this.TabPages[cmnuTabRect_TabRect_Idx], // 1.0.001 this.TdhTabPages[true, cmnuTabRect_TabRect_Idx], // 1.0.010 TDHTabCtl.TabEventArgs.TabEvents.TabAdded // 1.0.001 ) // 1.0.001 ); // 1.0.001 } // 1.0.001 } // 1.0.001 #endregion else // 1.0.001 #region Fire [.TabEvents.TabRenamed] event to client? if (editArgs.EditAccepted // 1.0.001 && (editArgs.EditText.Trim().Length > 0) // 1.0.001 ) // 1.0.001 { // 1.0.001 // Fire [.TabEvents.TabRenamed] event to client // 1.0.001 if (this.OnTabEvents != null) // 1.0.001 { // 1.0.001 this.OnTabEvents( // 1.0.001 this, // 1.0.001 new TDHTabCtl.TabEventArgs( // 1.0.001 cmnuTabRect_TabRect_Idx, // 1.0.001 //this.TabPages[cmnuTabRect_TabRect_Idx], // 1.0.001 this.TdhTabPages[true, cmnuTabRect_TabRect_Idx], // 1.0.010 TDHTabCtl.TabEventArgs.TabEvents.TabRenamed // 1.0.001 ) // 1.0.001 ); // 1.0.001 } // 1.0.001 } // 1.0.001 #endregion } // 1.0.001 } // 1.0.001 this.cmnuTabRect_Built = false; // 1.0.001 this._OnTabEvents_RenameIsAdd = false; // 1.0.001 } // 1.0.001