From 8fa11bb2a2a556f48af2de20f5dd9de8fcec97d2 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Wed, 9 Mar 2011 16:35:43 +0000 Subject: [PATCH] Don't pop up annoying message box in the drawing sample. The rubber banding selection message box was shown even after a simple click, i.e. when nothing was actually selected which was quite annoying, so don't do this. Also remove unnecessary casts and use wxLogMessage() instead of wxString::Printf() + wxMessageBox(). git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@67160 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- samples/drawing/drawing.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/samples/drawing/drawing.cpp b/samples/drawing/drawing.cpp index ce823f9821..cd65cb2364 100644 --- a/samples/drawing/drawing.cpp +++ b/samples/drawing/drawing.cpp @@ -1650,15 +1650,15 @@ void MyCanvas::OnMouseUp(wxMouseEvent &event) m_overlay.Reset(); m_rubberBand = false; - int x,y,xx,yy ; - event.GetPosition(&x,&y); - CalcUnscrolledPosition( x, y, &xx, &yy ); - - wxString str; - str.Printf( wxT("Rectangle selection from %d,%d to %d,%d"), - m_anchorpoint.x, m_anchorpoint.y , (int)xx, (int)yy ); - wxMessageBox( str , wxT("Rubber-Banding") ); + wxPoint endpoint = CalcUnscrolledPosition(event.GetPosition()); + // Don't pop up the message box if nothing was actually selected. + if ( endpoint != m_anchorpoint ) + { + wxLogMessage("Selected rectangle from (%d, %d) to (%d, %d)", + m_anchorpoint.x, m_anchorpoint.y, + endpoint.x, endpoint.y); + } } } -- 2.45.2