MP 7

Using the MFC AppWizard With A Dialog Based Application


The Assignment

In this assignment you will use the MFC AppWizard and create a dialog based application. You will add (using the controls menu) a number of components. These components will modify a static text item which will indicate which control has been selected.

Components You Will Add

  1. Two command buttons. They will change the static text to "Button 1 Pressed" and "Button 2 Pressed" respectively.
  2. Three Radio Buttons. Buttons should be labeled one, two and three. They will change the static text to "Radio Button one Pressed", "Radio Button two Pressed" and "Radio Button three Pressed"respectively.
  3. Add a Simple type ComboBox. When text is entered, it will be displayed as static text.
  4. Add a Dropdown type ComboBox. This ComboBox should have two items initially in it (DropdownComboBox1 and DropdownComboBox2). When text is entered or either item is selected, it will be displayed as static text.
  5. Add a Drop List type ComboBox with a 'closed' list box. The items that should be displayed are ListTypeComboBox1 and ListTypeComboBox2. The Edit control will NOT accept any input.
  6. Add a CEdit control. When the text is changed, it sould appear in the static text item.

Hints

To Display Static Text in your Dialog Box

Declare a member variable of your dialog as a pointer to CStatic:

	CStatic *Label;

Then, in your OnInitDialog, add the following:

Label = new CStatic;

Label->Create("I'm a static control too", WS_CHILD | WS_VISIBLE,
            CRect(10, 40, 160, 80), this, 1234); 

To change the caption:

void CPlotDlg::OnBnClickedButton1()
{
  Label->SetWindowText("I'm a changed static control");
}

Setting Which Radio Button is Highlighted

	void CheckRadioButton( int nIDFirstButton, int nIDLastButton, int nIDCheckButton );

You might also find helpful:

	int GetCheckedRadioButton( int nIDFirstButton, int nIDLastButton );

What to turn in

Zip up all of the project files and the code and put it onto a diskette. If you have trouble fitting all of the files in a file compatable with a diskette, try deleting the files in the debug directory directory.

A 3.5" diskette labeled with your name, course # and containing the file mp07.zip.