DEMONSTRATION OF RADIO BUTTONS

1.      DEMONSTRATION OF RADIO BUTTONS

DEMONSTRATION OF RADIO BUTTONS
Step 1:-Select a NEW file.
Step 2:-Select a project tab from new window and from that select MFC application wizard [exe] option and give a project name as Buttons 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 radio buttons 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 radio button controls to the left edge. To give vertical spacing select space evenly item and click the item in the menu.
Step 5:-Now connect the radio buttons to event handlers, view-> class wizard-> IDC_RADIO1->IDC_RADIO2-> IDC_RADIO3 and click BN_CLICKED for each radio button.
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 CRadioDlg and double click on OnRadio1(), OnRadio2(), OnRadio3() methods.
                        void CRadioDlg::OnRadio1()
                        {
                                    m_text=”Radio 1 Clicked”;
                                    UpdateData(false);
                        }
                        void CRadioDlg::OnRadio2()
                        {
                                    m_text=”Radio 2 Clicked”;
                                    UpdateData(false);
                        }
                        void CRadioDlg::OnRadio3()
                        {
                                    m_text=”Radio 3 Clicked”;
                                    UpdateData(false);
                        }

Step 8:-Build……………Compile…………….Execute.

No comments:

Post a Comment