dialog is modal, and Show(false) if the dialog is not modal. This allows
the default handlers for OK and Cancel to function without assertions.
This code is copied more or less directly from src/msw/dialog.cpp.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35730
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
void OnOK(wxCommandEvent& event);
void OnApply(wxCommandEvent& event);
void OnCancel(wxCommandEvent& event);
+
+ // end either modal or modeless dialog
+ void EndDialog(int rc);
+
};
#endif // _WX_COCOA_DIALOG_H_
Show(false);
}
+void wxDialog::EndDialog(int retCode)
+{
+ if(IsModal())
+ EndModal(retCode);
+ else
+ Show(false);
+}
+
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
// We'll send a Cancel message by default,
{
if ( Validate() && TransferDataFromWindow() )
{
- EndModal(wxID_OK);
+ EndDialog(wxID_OK);
}
}
void wxDialog::OnCancel(wxCommandEvent& event)
{
wxLogTrace(wxTRACE_COCOA,wxT("Cancelled!"));
- EndModal(wxID_CANCEL);
+ EndDialog(wxID_CANCEL);
}