Take this variable mapping in a CDialog
:
DDX_Check(pDX, IDC_CHECK_PREVIEW_CURRENT_WEEK, m_bPreviewCurrentWeek);
By design in the IDE it to map to a BOOL
variable instead of a bool
variable.
I know that under normal circumstances you can just use a bool
variable wherever TRUE
or FALSE
is used. But, when I try changing my member variable to a bool
it fails to compile on the DDX_Check
routine.
Can we use bool
with a checkbox control?
@Jabberwocky's comment reminded me that I have already implemented some custom DDX routines:
So I delved into the MFC source and modified a copy in my own cpp file:
I commented out the validation checks since
bool
has only one of two values anyway. Shout if you think that was a mistake.So I am now able to do this:
It works fine.