对话框类不允许我在对话框上与 CButton 交互?
Dialog Class doesn't let me interact with CButton on the dialog?
如果我在myTab类中创建CButton,我就不能作为用户与它交互。
但是,如果我在Main CD对话框中"创建"了CButton,并将pParentWnd设置为dlgMine,那么我就可以与进行交互。
Thx
//Main CDialog
CDialog *dlgMine = new myTab(this);
dlgMine->Create(IDD_DIALOG1,this);
dlgMine->SetWindowPos(&wndTop, 20, 20, 300, 300, SWP_SHOWWINDOW);
myTab::myTab(CWnd* pParent /*=NULL*/)
: CDialog(myTab::IDD, pParent)
{
//{{AFX_DATA_INIT(myTab)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
CButton *btn = new CButton();
btn->Create("Run", WS_BORDER|WS_CHILD|WS_VISIBLE|BS_PUSHBUTTON,CRect(40,40,100,100),this,10);
}
您不应该在对话框构造函数中创建按钮,因为对话框本身仍未创建。请改为在OnInitDialog中执行此操作。
相关文章:
- 如何在Qbutton的帮助下更改Q对话框的宽度
- 当对话框被接受时,如何用参数调用槽
- WinAPI 在单击第一个对话框上的按钮控件并销毁第一个对话框后创建第二个对话框
- 如何多次询问来自QML对话框的输入?
- 选择文件对话框错误
- 自定义对话框(源自QDialog)不会关闭(Android)
- 如何在 MFC 对话框中使用 OnDraw
- 在C++中创建文件夹选取器对话框的最简单方法是什么?
- 从资源视图访问对话框时出现问题
- 如何检测窗口当前是否正在运行模式对话框?
- "最小化"按钮不会出现在 MFC 对话框中
- 如何获取QNetworkConfiguration UserChoice对话框?
- 表单显示对话框函数错误,并且不执行下面的语句
- 如何在 VC6 中的对话框中将图标设置为按钮
- C++/Win32 构造函数不使用从对话框获取的字符串初始化变量
- 在 Win32 应用中,如果未选择文件夹并且用户单击"确定",则文件夹选择对话框将关闭
- 在主窗口之前显示登录对话框并隐藏主窗口按钮
- 找不到没有具有类名 #32770 的窗口名称的父窗口的子窗口(对话框)
- 如何在主窗口标签的对话框中显示QLineEdit的输入
- 对话框类不允许我在对话框上与 CButton 交互?