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
This commit is contained in:
Vadim Zeitlin 2011-03-09 16:35:43 +00:00
parent 621d922ffd
commit 8fa11bb2a2

View File

@ -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);
}
}
}