VC6 中的多模式对话框?

发布于 2024-12-22 19:11:00 字数 904 浏览 7 评论 0原文

我正在开发一个应用程序,该应用程序允许用户编辑应用程序其他部分生成的发票。查看发票时,如果选择编辑>编辑发票,则会启动模式对话框,

void CViewInvoiceView::OnEditEditinvoice() 
{
    CEditInvoiceDlg dlg;
    if (dlg.DoModal() == IDOK)
    {
        // Do Stuff
    }
}

这可以正常工作。但是,由于最近的规范更改,我现在需要提取与运输信息相关的字段,并通过单击第一个对话框中包含的编辑运输按钮,在单独的对话框中使它们可编辑。

void CEditInvoiceDlg::OnButtonEditshipping() 
{
    CEditInvoiceShippingDlg shippingDlg;
    shippingDlg.m_shipToList = &m_shipToList;

    if (shippingDlg.DoModal() == IDOK)
    {
            // Do Stuff
    }

}

我的问题是我无法打开第二个对话框(CEditInvoiceShippingDlg)。消息映射看起来不错,

BEGIN_MESSAGE_MAP(CEditInvoiceDlg, CDialog)
...
ON_BN_CLICKED(IDC_BUTTON_EDITSHIPPING, OnButtonEditshipping)
...
END_MESSAGE_MAP()

但如果我在 OnButtonEditshipping() 函数中放置一个断点,它永远不会在该点停止。单击编辑运输按钮实际上会关闭它所在的对话框,而不是打开第二个对话框。

I'm working on an application that allows users to edit invoices generated in other parts of the app. When viewing an invoice, if Edit>Edit Invoice is selected, a modal dialog is launched

void CViewInvoiceView::OnEditEditinvoice() 
{
    CEditInvoiceDlg dlg;
    if (dlg.DoModal() == IDOK)
    {
        // Do Stuff
    }
}

This works fine. However, due to a recent spec change, I now need to extract the fields related to shipping information, and make them editable in a separate dialog accessible by clicking a Edit Shipping button contained in the first dialog.

void CEditInvoiceDlg::OnButtonEditshipping() 
{
    CEditInvoiceShippingDlg shippingDlg;
    shippingDlg.m_shipToList = &m_shipToList;

    if (shippingDlg.DoModal() == IDOK)
    {
            // Do Stuff
    }

}

My problem is that I can't get the second dialog (CEditInvoiceShippingDlg) to open. The message map looks ok

BEGIN_MESSAGE_MAP(CEditInvoiceDlg, CDialog)
...
ON_BN_CLICKED(IDC_BUTTON_EDITSHIPPING, OnButtonEditshipping)
...
END_MESSAGE_MAP()

but if I place a break point in my OnButtonEditshipping() function, it never stops on that point. Clicking the Edit Shipping button actually closes the dialog it's contained in instead of opening a second.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残疾 2024-12-29 19:11:00

查看您的resource.h 文件并确保没有两个ID 分配给同一编号。您还应该检查以确保它们都不在保留范围内: MSDN
TN020:ID 命名和编号约定

Look in your resource.h file and make sure there aren't two IDs assigned to the same number. You should also check to make sure none of them are in reserved ranges: MSDN
TN020: ID Naming and Numbering Conventions

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文