Step 4:

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


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


Declaration step ...
  • Search operation - to find a record corresponding to the address you specified.
  • List of controls to be add: four Static Texts and eight combo boxes.

    Note:
    Four Static Texts and four
    combo boxes to be appear only in the 2nd tab page of the Tab control.

Details ...

The IDD_TESTVC0_DIALOG dialog design, part 4.

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

Note:
The label
of the 2nd tab page is By address.


  1. Graphic ...

    Create the new Bitmap file - select.bmp:
    • Select TestVC0 resources. From the right mouse pop-up menu, click Insert.
    • In the Insert Resources dialog box appears, select Bitmap Icon and then click New.

      Note
      :
      New Bitmap item appears.
    • In the Bitmap Window appears, draw the word: Select ...
    • Select the IDB_BITMAP1 of the folder Bitmap. From the right mouse pop-up menu,
      click Properties.
    • In the Bitmap Properties dialog box appears, modify the data:
      The old values The new values
      ID: IDB_BITMAP1
      File name: res\bitmap1.bmp
      ID: IDB_SELECT
      File name: res\select.bmp

      From the File menu, click Save.

  2. Add controls ... - (2 lists ...)

    1. The 1st list of controls . - (appears in the 2nd tab page)

      1. Add the Picture - IDC_STATICSEL, Picture Properties:
        Right click the Picture and click Properties on the shortcut menu to open the Picture Properties dialog box.:
        General tab
        * ID:
        *
        box checked
        * Type:
        * Image:

        IDC_STATICSEL
        Visible
        Bitmap
        IDB_SELECT


      2. Add the Static Text - IDC_STATICBOOK, Text Properties:
        Right click the Static Text and click Properties on the shortcut menu to open the Text Properties dialog box:
        General tab
        * ID:
        *Caption:
        *
        boxes checked
        Styles tab
        * Align text:

        IDC_STATICBOOK
        Book:
        Visible, Group

        Default


      3. Add the combo box - IDC_COMBO_BOOK, combo box Properties:
        A combo box consists of a list box combined with either a static control or edit control.
        The list-box portion of the control may be displayed at all times or may only drop down
        when the user selects the drop-down arrow next to the control.


        Right click the
        combo box and click Properties on the shortcut menu to open the combo box Properties dialog box.:
        General tab
        * ID:
        *
        boxes checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_BOOK
        Visible, Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      4. Add the Static Text - IDC_STATICTITLE, Text Properties:
        Right click the Static Text and click Properties on the shortcut menu to open the Text Properties dialog box:
        General tab
        * ID:
        *Caption:
        *
        boxes checked
        Styles tab
        * Align text:

        IDC_STATICTITLE
        Title:
        Visible, Group

        Default


      5. Add the combo box - IDC_COMBO_TITLE, combo box Properties:
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        boxes checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_TITLE
        Visible, Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      6. Add the Static Text - IDC_STATICCHAPTER, Text Properties:
        Right click the Static Text and click Properties on the shortcut menu to open the Text Properties dialog box:
        General tab
        * ID:
        *Caption:
        *
        boxes checked
        Styles tab
        * Align text:

        IDC_STATICCHAPTER
        Chapter:
        Visible, Group

        Default


      7. Add the combo box - IDC_COMBO_CHAPTER, combo box Properties:
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        boxes checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_CHAPTER
        Visible, Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      8. Add the Static Text - IDC_STATICVERSE, Text Properties:
        Right click the Static Text and click Properties on the shortcut menu to open the Text Properties dialog box:
        General tab
        * ID:
        *Caption:
        *
        boxes checked
        Styles tab
        * Align text:

        IDC_STATICVERSE
        Verse:
        Visible, Group

        Default


      9. Add the combo box - IDC_COMBO_VERSE, combo box Properties:
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        boxes checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_VERSE
        Visible, Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll
    2. The 2nd list of controls . - (all combo boxes of this list are linking to the combo boxes of
      the 1st list
      )
      1. Add the combo box - IDC_COMBO_BOOK_RECNO, combo box Properties (Not Visible):
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        boxes checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_BOOK_RECNO
        Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      2. Add the combo box - IDC_COMBO_TITLE_RECNO, combo box Properties (Not Visible):
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        box checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_TITLE_RECNO
        Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      3. Add the combo box - IDC_COMBO_CHAPTER_RECNO, combo box Properties (Not Visible):
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        box checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_CHAPTER_RECNO
        Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll


      4. Add the combo box - IDC_COMBO_VERSE_RECNO, combo box Properties (Not Visible):
        Right click the combo box and click Properties on the shortcut menu to open the combo box Properties dialog box:
        General tab
        * ID:
        *
        box checked
        Styles tab
        * Type:
        * Owner draw:
        *
        boxes checked

        IDC_COMBO_VERSE_RECNO
        Tab stop

        Dropdown
        No
        Vertical scroll, Auto HScroll

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

  3. Multi - operation ...
    1. Add member Varaiables.
      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_ STATICSEL.
      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_staticsel.
      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 - CStatic.
      8. Click OK.

        Note:
        The member name and type you specified now appear in the Control IDs list.

      Repeat steps 3 through to 8 to add a member Varaiable for other controls:

      Control IDs Member Variable name Category Variable Type
      IDC_STATICSEL
      IDC_STATICBOOK
      IDC_STATICTITLE
      IDC_STATICCHAPTER
      IDC_STATICVERSE
      IDC_COMBO_BOOK
      IDC_COMBO_TITLE
      IDC_COMBO_CHAPTER
      IDC_COMBO_VERSE
      I
      DC_COMBO_BOOK_RECNO
      IDC_COMBO_TITLE_RECNO
      IDC_COMBO_CHAPTER_RECNO
      IDC_COMBO_VERSE_RECNODC..
      m_staticsel
      m_staticbook
      m_statictitle
      m_staticchapter
      m_staticverse
      m_combobook
      m_combotitle
      m_combochapter
      m_comboverse
      m_combobookrecno
      m_combotitlerecno
      m_combochapterrecno
      m_comboverserecno
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      Control
      CStatic
      CStatic
      CStatic
      CStatic
      CComboBox
      CComboBox
      CComboBox
      CComboBox
      CComboBox
      CComboBox
      CComboBox
      CComboBox
      CComboBox


    2. ClassWizard makes changes to TestVC0Dlg.h and TestVC0Dlg.cpp files after you’ve mapped
      the controls to member variables. Examine these changes,
      click here.

    3. Makes part of these controls visible ...
      At the 1st time, the last controls added hide.
      When you select the 2nd tab page, some of the last controls only display.
      This operation make 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
  4. The Code .files... (Next Page ------->)

Previous
Home 7 Home
Next