6. DEMONSTRATION OF CHECK BOXES
Step 2:-Select a project tab from new window and from that select MFC application wizard [exe] option and give a project name as Checks and click ok.
Step 3:-
Þ MFC Application Wizard window is appeared.
Þ Select dialog based settings in step 1, click next.
Þ Select default settings from step 2 to step 6 and click finish.
Þ New projects information on window will appear and click ok.
Step 4:-Drag and drop three check boxes and one edit box from tool box and align the controls, to align horizontally, select the align menu item in the layout menu. This opens a submenu, select left in the submenu to align the check box controls to the left edge. To give vertical spacing select space evenly item and click the item in the menu.
Step 5:-Now goto view -> class wizard -> IDC_CHECK1-> IDC_CHECK2-> IDC_CHECK3 and click BN_CLICKED for each check box and add event Handlers OnCheck1(), OnCheck2(), OnCheck3().
Step 6:-Add a member variable to the edit box, for that goto-> class wizard->member variables->IDC_EDIT1-> and give name as m_text and click ok.
Step 7:-Goto class view tab and open CCheckboxDlg and double click OnCheck1(), OnCheck2(), OnCheck3(), and add code,
void CChecksDlg::OnCheck1();
{
m_text = “Check1 Clicked”;
UpdateData(false);
}
void CChecksDlg::OnCheck2();
{
m_text = “Check2 Clicked”;
UpdateData(false);
}
void CChecksDlg::OnCheck3();
{
m_text = “Check3 Clicked”;
UpdateData(false);
}
Step 9:-Build…………Compile………….Execute.
No comments:
Post a Comment