Click to See Complete Forum and Search --> : I need help with checkbox
yang
April 21st, 1999, 09:58 AM
I had two checkboxes in my dialog. I did use ClassWizard to attaching two functions for those checkboxes in my Dlg.cpp file. However, I don't know where I shall put the code (in.cpp or dlg.cpp)for controling those checkboxes when the user click on one of checkboxes? For example, one of my checkboxes was named "top". when the user click on the checkbox, the program will read through the file the user enter, and pick up data related with "top" checkbox. I really want to know where I can put those code to execute those works, after the user click on "top" button.
Anyone can help me out?
thank you.
Paul McKenzie
April 21st, 1999, 11:13 AM
Usually, the action does not start when the user clicks the checkbox. The real work starts when the user presses "Go", "Start", "Ok", or some button that lets the processing start. This is good UI design.
The place to do the processing would be in the OnOk(), OnStartProcessing(), or some function that is called when the user selects "Start". In the processing function, you would determine what checkbox has been checked, and then set up what you need to do.
Regards,
Paul McKenzie
yash
April 21st, 1999, 11:14 AM
Hi,
You can put all those code in ON_BN_CLICKED for that check box button in the ur dialod derived class.
Hope this helps U.
Good Luck.
Yash.
yang
April 21st, 1999, 01:10 PM
Thank you for your help. Actually, I already created functions for both of checkboxes. I just don't know how to make the program to response the user's action, when the user clicks on one of boxes. I include the functions of checkboxes here. Do you have any good idea about my problem?
thank you for you help.
void CDesignDlg::OnTop()
{
}
void CDesignDlg::OnBottom()
{
// TODO: Add your control notification handler code here
}
I have two check boxes, one is for "top" and the
other is for "bottom." I have OnTop() to handle when the user clicks the
"top" box, and I have OnBottom() to handle when the user clicks the
"bottom" box. when the user clicks on "top" box, the program will doing something, and when the user clicks on "bottom" box, the program will doing something else.
Paul McKenzie
April 21st, 1999, 06:54 PM
First, Check out CButton::GetCheck() to determine the state of the checkbox and CButton::SetCheck() to set the state. You will need to get the CWnd of the checkbox control for this to work. This can be done by calling (CButton *)GetDlgItem(Id), where Id is the identifier that you gave the control when you created the checkbox.
Second, you need to setup handlers for each checkbox control. You would do this through class wizard.
Regards,
Paul McKenzie
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.