Close the gestures frame too in the event sample

Make "Exit" menu item really exit the sample again instead of just
closing the main window, but possibly leaving the gestures testing
window still open and thus not really exiting the program.

Also avoid creating more than one gesture window, use the existing one
if we had already opened it.
This commit is contained in:
Vadim Zeitlin
2017-11-30 21:40:24 +01:00
parent fc9244614a
commit 9655ca9e68

View File

@@ -182,7 +182,7 @@ private:
// the button used to highlight the event handlers execution order
MyEvtTestButton *m_testBtn;
MyGestureFrame *m_gestureFrame;
wxWindowRef m_gestureFrame;
// any class wishing to process wxWidgets events must use this macro
@@ -457,7 +457,8 @@ MyFrame::~MyFrame()
void MyFrame::OnQuit(wxCommandEvent& WXUNUSED(event))
{
// true is to force the frame to close
if ( m_gestureFrame )
m_gestureFrame->Close(true);
Close(true);
}
@@ -589,8 +590,15 @@ void MyFrame::OnPopEventHandler(wxCommandEvent& WXUNUSED(event))
void MyFrame::OnGesture(wxCommandEvent& WXUNUSED(event))
{
m_gestureFrame = new MyGestureFrame();
m_gestureFrame->Show(true);
if ( m_gestureFrame )
{
m_gestureFrame->Raise();
}
else
{
m_gestureFrame = new MyGestureFrame();
m_gestureFrame->Show(true);
}
}
void MyFrame::OnTest(wxCommandEvent& WXUNUSED(event))