Visual C++ and MFC Programming 2nd Edition

(Martin Jones) #1

Visual C++ and MFC Fundamentals Chapter 17: Track-Based Controls



  1. Display the new dialog box, right-click the Suggested Username edit box and click
    Add Variable

  2. Set the Variable Name to m_StrUsername

  3. Set its Category to Value

  4. Set the Maximum Characters to 5

  5. Add control and value variables to the controls as follows:


Control ID Control
Variable

Value Variable Max
Chars
Edit Box IDC_FULL_NAME m_StrFullName
Edit Box IDC_USERNAME m_Username m_StrUsername 5
Edit Box IDC_PASSWORD m_Password m_StrPassword 14
Edit Box IDC_CONF_PASSWORD m_StrConfPassword


  1. Display the main form.

  2. Add a button under the Web Site edit box and its Caption to Account Setu&p

  3. Change the Identifiers of the edit boxes and the button from left to right and from top
    to bottom as follows: IDC_DATE_HIRED, IDC_EMPLOYEE_NBR,
    IDC_FIRST_NAME, IDC_MI, IDC_LAST_NAME, IDC_ADDRESS, IDC_SUITE,
    IDC_CITY, IDC_STATE, IDC_ZIP_CODE, IDC_HOME_PHONE,
    IDC_WORK_PHONE, IDC_EMAIL_ADDRESS, IDC_WEB_SITE,
    IDC_BTN_ACCOUNT

  4. Set the Disabled property of the Account Setup button to True

  5. Set the Uppercase of the MI edit box to True

  6. Add some CString value and a CButton Control variables to the controls as follows:


Control Identifier Value Variable Control Variable Max Chars
Edit Box IDC_FIRST_NAME m_StrFirstName
Edit Box IDC_MI m_StrMI 1
Edit Box IDC_LAST_NAME m_StrLastName
Button IDC_BTN_ACCOUNT m_BtnAccount


  1. Add a BN_CLICKED Event Handler to the button associated with the view class
    and implement it as follows:

Free download pdf