Control Problem for TabCtrl under VC (original)

zhaozj2021-02-16  54

Doing the VC interface knows that if you encounter multiple controls with TabCtrl group display, it is a very cumbersome thing, and the code quantity is also very large.

. Below is a solution I just think of satisfaction this afternoon.

The main idea is as follows: Be a class CTabContainer, determine the control ID into a few groups (that is, several Tab tags), then do one for each group

The linked lists saves the control ID sets of each Tab. In this case, just do a basic setting when the dialog is initialized, then in ONSE

LCHANGETAB1 Write on M_ptabContainer-> show (m_tab.getcurseel ());

How to use:

In OnInitDialog () m_ptabcontainer-> init (3, this); // 3 Tab tab buttons, this dialog pointer. m_pTabContainer-> AddCtrlId (0, IDC_BUTTON1); // IDC_BUTTON1 applied to the first set of tab which m_pTabContainer-> AddCtrlId (0, IDC_BUTTON4); // following similar m_pTabContainer-> AddCtrlId (0, IDC_BUTTON5); m_pTabContainer-> AddCtrlId (1 , IDC_BUTTON2); m_pTabContainer-> AddCtrlId (1, IDC_BUTTON6); m_pTabContainer-> AddCtrlId (2, IDC_BUTTON3); m_pTabContainer-> AddCtrlId (2, IDC_BUTTON7); m_pTabContainer-> AddCtrlId (2, IDC_BUTTON8); m_pTabContainer-> Show (0 ); // Default Shows the control below the first tag

At the control Tab's event onselchangetab1 m_ptabcontainer-> show (m_tab.getcurseel ());

Attached CTabContainer class source code: class CTabContainer {public: CTabContainer (); virtual ~ CTabContainer (); CTabContainer (const CTabContainer & tabContainer); const CTabContainer & operator = (const CTabContainer & tabContainer);

BOOL INIT (INT NTABS, CWND * PPARENT);

// Initialize Tab, NTABS represents a few twisting BOOL AddCtrlid (int NTAB, INT NID); // Add ID to which Tab is bool delete (int NTAB, INT NID); // Delete ID Void Show (int NTAB) ); // Which Tab void clear (void) currently shows; // Release memory and cleanup work

Protected: Typedef Clist cintlist; cintlist * m_pidgroups; // Pointer Pointer Pointer INT m_nlcount; // Number of CWnd * m_pparent; // Parent Winding Pointer};

/// // Constructor CTabContainer :: CTabContainer () {m_pparent = NULL; M_PIDGROUPS = NULL; m_nlcount = 0;

}

/ / / Virtual destructor :: ~ ctabcontainer () {clear ();

}

/ // copy constructor CTabContainer :: CTabContainer (const CTabContainer & tabContainer) {// to be achieved Clear ();} / // Overload assignment operator const CTabContainer & CTabContainer :: operator = (const CTabContainer & tabContainer) {/ / Wait to achieve return * this;}

/ / / / / NTABS represents a few twisting bool ctabcontainer :: init (int ntabs, cwnd * pparent) {assert (ntabs> 0 && pParent! = Null); clear (); m_nlcount = ntabs; m_pparent = pparent = NTABS; m_pparent = pparent M_PIDGROUPS = new cintlist [ntabs]; assert (m_pidgroups! = Null);

Return True;}

/ / / / / {Assert (Ntab

/ / / / Delete the specified ID Bool CTabContainer :: Delete (int NTAB, INT NID) {Assert (ntab

/ / // // currently display which Tab Void CTabContainer :: Show (int NTAB); INT NID = 0; position npos = 0; for (int i = 0; i getdlgitem (NID) -> showwindow ((i == ntab)? sw_show: sw_hide }}

}

/ / / / / {If (m_pidgroups! = Null) {delete [] m_pidgroups; m_pidgroups = null; m_pidgroups = null; m_nlcount = 0;}

}

My current work is:

The slip ring is a loop central conductor, an outer layer of a loop cable as a shield ring. The signal transmitted 12 MHz is usually used using a coaxial shielded slip ring. The cross section of this slip ring is a groove shape, essentially the rectangular coaxial conductor, and there is a capacitive medium frequency slip ring, the center conductor is ring Shape, supported by the insulating pad on the shield. Medium-frequency slip ring is used to transmit radar intersection (tens of megaherthe) signals and energy slip ring assemblies. This type of slip ring is high, and the general conductive slip ring can be used below 12 MHz.

转载请注明原文地址:https://www.9cbs.com/read-24269.html

New Post(0)