[英]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.