我们可以将复选框映射到MFC而不是Bool中的Bool变量吗?
在cdialog
中进行此变量映射:
DDX_Check(pDX, IDC_CHECK_PREVIEW_CURRENT_WEEK, m_bPreviewCurrentWeek);
通过在IDE中进行设计,将其映射到bool
变量,而不是bool
变量。
我知道,在正常情况下,您可以在使用true
或false
的情况下只使用bool
变量。但是,当我尝试将我的成员变量更改为bool
时,它将无法在ddx_check
例程上编译。
我们可以使用复选框控件使用bool
吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
@jabberwocky的评论提醒我,我已经实现了一些自定义DDX例程:
所以我深入了MFC源,并在自己的CPP文件中修改了副本:
我评论了验证检查,因为
bool
无论如何还是两个值之一。如果您认为这是一个错误,请大喊。因此,我现在可以做到这一点:
它可以正常工作。
@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.