简体   繁体   English

如何在无模式对话框中检查是否单击了按钮

[英]How can i check that button is clicked in no modal dialog

I created main dialog and call no modal dialog, how can i check in main dialog that button is clicked in no modal? 我创建了主对话框并调用了无模式对话框,如何在主对话框中检查无模式下单击了按钮?

For example if i call modal i can check like this: 例如,如果我调用模态,我可以像这样检查:

Dialog Dlg;
int DlgResult = static_cast<int>(Dlg.DoModal());

if (DlgResult== IDOK)
{                               
   //do smth.
}

如果它是自定义对话框,则一种方法是在非模式对话框关闭时使用SendMessage()PostMessage()将结果发送到主对话框。

Even after the window closes, you will still have access to the C++ object representing the dialog. 即使在关闭窗口之后,您仍然可以访问代表对话框的C ++对象。 You can override OnOK and OnCancel and have them save a flag in the object. 您可以覆盖OnOK和OnCancel,并让它们在对象中保存一个标志。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何检查QPushButton是否被单击 - How can I check if QPushButton is clicked 如何在Qt中将模式对话框窗口转换为非模式对话框窗口? - How can I convert modal dialog window to non-modal dialog window in Qt? 如何使用IFileOpenDialog打开* modal *文件对话框? - How can I open an *modal* file dialog with IFileOpenDialog? 如何在另一个线程中关闭MFC Modal对话框并获得对话框的返回值? - How do I close a MFC Modal Dialog in another thread and can get the dialog return value? 单击按钮后如何使UI对象仅出现在对话框中 - How to get UI objects to only appear in dialog AFTER button is clicked 如何更改非模态对话框的默认CDialog字体? - How can I change the default CDialog font for a non-modal dialog? 我如何才能使MFC中的按钮根据之前单击的按钮做些不同的事情? - How can I make a button in MFC do something different based on what previous button was clicked? 我可以在MFC工具栏中创建无法单击的按钮/图标吗? - Can I make a button/icon in a MFC toolbar that can't be clicked? 当模式对话框打开时,不能单击Firemonkey应用程序,除非单击模式对话框本身 - Cant focus Firemonkey application when modal dialog open, unless modal dialog itself is clicked 如何在单击按钮的确切时刻获取小部件的值 FLTK - How can I get the value of a widget the exact moment a button is clicked FLTK
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM