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);
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_
};
#endif // _WX_COCOA_DIALOG_H_
+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,
void wxDialog::OnCloseWindow(wxCloseEvent& event)
{
// We'll send a Cancel message by default,
{
if ( Validate() && TransferDataFromWindow() )
{
{
if ( Validate() && TransferDataFromWindow() )
{
void wxDialog::OnCancel(wxCommandEvent& event)
{
wxLogTrace(wxTRACE_COCOA,wxT("Cancelled!"));
void wxDialog::OnCancel(wxCommandEvent& event)
{
wxLogTrace(wxTRACE_COCOA,wxT("Cancelled!"));
+ EndDialog(wxID_CANCEL);