WTL界面问题

这篇博客探讨了在使用WTL进行界面开发时遇到的三个主要问题:1) 主窗体坐标转换,需要将控件坐标转换为对话框相对坐标;2) 自定义控件未显示,可能是因为缺少在构造函数中的注册;3) DDX控件操作错误,可能是资源ID问题或初始化未赋值。解决方案包括正确转换坐标,确保控件注册和检查DDX操作是否涉及禁用的控件。
摘要由CSDN通过智能技术生成

WTL界面问题

==================================================

1、setwindowpos()中主窗体坐标系从左上(0,0)开始
移动控件位置时不要忘记转换控件坐标系为对话框的相对坐标(screentoclient(rect)

2、添加CustomCtrl 定制控件后对话框未弹出的问题:要在构造函数中registerclass,以及控件属性界面设置class为需要的类型如:Listctrl、Edit等等
3、An unsupported operation was attempted“ 有时候DDX报错可能是资源id的问题, 或者在对话框初始化中没有给赋值
http://www.cppblog.com/flyingxu/archive/2006/05/31/7963.html
https://stackoverflow.com/questions/42729770/mfc-ddx-radio-causes-debug-assertion-failure-when-dodataexchange-is-called-dlgd

DDX_RADIO
The problem is, that the auto radio button stuff in Windows skips buttons that are disabled. In detail. You click on button 2 while button 3 is selected and disabled. Button 2 gets selected but button 3 is not unchecked.

The next problem occurs when DoDataExchange runs. It doesn’t check if a button is enabled or disabled. DDX_Radio just loops over all radio buttons, and it find 2 buttons in the group are enabled. This causes the ASSERT. DDX_Radio don’t care if a button is enabled or disabled.

My advice: Use a custom OnClick handle by yourself, and disable all other buttons manually.

设置group

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值