X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e6d94998fcbdb3ce60774e38c0d4b6ee20c6798..f3d4cc30e9bd2d06453388d91d64e295fce33caa:/samples/forty/forty.cpp

diff --git a/samples/forty/forty.cpp b/samples/forty/forty.cpp
index 6195e27f4b..4d952a9993 100644
--- a/samples/forty/forty.cpp
+++ b/samples/forty/forty.cpp
@@ -40,7 +40,7 @@ public:
 	FortyFrame(wxFrame* frame, char* title, int x, int y, int w, int h);
 	virtual ~FortyFrame();
 
-	bool OnClose();
+	void OnCloseWindow(wxCloseEvent& event);
 
 	// Menu callbacks
 	void NewGame(wxCommandEvent& event);
@@ -73,6 +73,7 @@ BEGIN_EVENT_TABLE(FortyFrame, wxFrame)
 	EVT_MENU(SCORES, FortyFrame::Scores)
 	EVT_MENU(RIGHT_BUTTON_UNDO, FortyFrame::ToggleRightButtonUndo)
 	EVT_MENU(HELPING_HAND, FortyFrame::ToggleHelpingHand)
+    EVT_CLOSE(FortyFrame::OnCloseWindow)
 END_EVENT_TABLE()
 
 // Create a new application object
@@ -90,7 +91,7 @@ bool FortyApp::OnInit()
 			-1, -1, 668, 510
 			);
 
-	// Show the frame
+ 	// Show the frame
 	frame->Show(TRUE);
 
 	return TRUE;
@@ -189,9 +190,14 @@ FortyFrame::~FortyFrame()
 {
 }
 
-bool FortyFrame::OnClose()
+void FortyFrame::OnCloseWindow(wxCloseEvent& event)
 {
-	return m_canvas->OnClose();
+    if (m_canvas->OnCloseCanvas() )
+    {
+        this->Destroy();
+    }
+    else
+        event.Veto();
 }
 
 void
@@ -205,7 +211,7 @@ FortyFrame::Exit(wxCommandEvent&)
 {
 #ifdef __WXGTK__
 	// wxGTK doesn't call OnClose() so we do it here
-	if (OnClose())
+//	if (OnClose())
 #endif
 	Close(TRUE);
 }