Step 3:

Application developed with Microsoft Visual C++, Part 5.


4th Step, Add the 2nd list of controls to IDD_TESTVC0_DIALOG dialog.


Declaration step ...
  • List of control to be add: one Tab control.

Details ...


The IDD_TESTVC0_DIALOG dialog design, part 2.

Learn how to write a Visual C++ application ...


  1. Add the Tab control - IDC_TAB1, Tab control Properties:
    A Tab control is analogous to a set of dividers in a notebook or labels in a file cabinet. In a property sheet, a user selects a tab to move from one property sheet page to another. Each tab consists of a
    group of controls.
    This Tab control consists of two tab pages.

    Right click the Tab control and click Properties on the shortcut menu to open the Tab control Properties dialog box:
    General tab
    * ID:
    *
    boxes checked
    Styles tab
    * Alignments Right:
    * Focus:

    IDC_TAB1
    Visible, Tab stop

    Justify
    Default

    Note:
    The TestVC0.rc file stores information about all controls included in IDD_
    TESTVC0_DIALOG.
    Examine this information,
    click here.

  2. Multi - operation ...

    1. Add a member Variable.
      1. On the View menu, click ClassWizard.
        The MFC ClassWizard dialog box appears, click the Member Variables tab.

        Note:
        This tab, contains a list box displaying the mapping between controls and member variables.
      2. In the Class name box, select the class CTestVC0Dlg.
      3. Select the name of the Control ID you want to add a variable - IDC_ TAB1.
      4. Click Add Variable, the Add Member Variable dialog box appears.
      5. In the Member variable name text box, type the name of the variable - m_tab1.
      6. In the Category drop-down list, select the appropriate type of variable - Control.
      7. In the Variable type drop-down list, select the appropriate class that defines the
        variable's data type - CTabCtrl.
      8. Click OK.

        Note:
        The member name and type you specified now appear in the Control IDs list.
    2. ClassWizard makes changes to TestVC0Dlg.h and TestVC0Dlg.cpp files after you’ve mapped
      the control - IDC_TAB1 to member variable. Examine these changes,
      click here.

    3. Initialize the Tab control - IDC_TAB1.
      To set the number of the tab pages and specify the tab labels.

      Note:
      The Tab control consists of two tab pages, the 1st tab label is 'By Word' and the 2nd tab
      label is 'By address'.
      This operation makes changes to TestVC0Dlg.cpp file. Examine these changes,
      click here.

    4. Save this application.
      Run
      it, from Build menu, choose and click Execute TestVC0.exe.

Previous
Home 5 Home
Next