August 20th, 2012, 10:57 AM
creating and accessing a checkbox
Windows XP Pro, Visual Studio 2008, C++, MFC
Goal: use some checkboxes
Created a Dialog
Created a class for the dialog: C_Control_Logging
Created a checkbox: ID = IDC_CBOX_ENABLE_ALL_LOGGING
Right clicked checkbox and added a variable: m_cbox_logging_enabled
In the constructor is the code:
[code] m_c_box_logging_enabled.SetCheck( BST_CHECKED )[/code}
The result when stepping over this line of code is a popup saying:
Debug Assertion Failed!
The line of code referenced is in afxwin2.inl. I read this as a safety
check point telling me I have a fundamental error in the checkbox code.
I am suspecting that I am not getting the variable associated with the checkbox,
but don't know how to do that.
when I open the properties of the checkbox I don't recognize anything that
indicates that this checkbox is checked or not checked.
How do I get access to this checkbox?
What should I do different?
(BTW: I have been searching, but everything I find is either not C++ or involves creating a checkbox from scratch. I have already created a couple using the Dialog utilities and now just need to find out how to access them.)
Edit: Just so it is said, I can open and close the new dialog box.
Edit again: After reading some more in my text book, I see that my new class does not have an OnInitDialog() function. I supose that means I created the class incorrectly, but I don't see the error of my ways. The book says I can over-ride it, but I have not been able to find that property box yet.
Thank you for your time.
Last edited by bkelly; August 20th, 2012 at 11:34 AM.
Tags for this Thread
Click Here to Expand Forum to Full Width
This a Codeguru.com survey!