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.
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