BEGIN_EVENT_TABLE(MyCanvas, wxScrolledWindow)
EVT_PAINT( MyCanvas::OnPaint)
- EVT_LEFT_DOWN( MyCanvas::OnMouseDown)
+ EVT_MOUSE_EVENTS( MyCanvas::OnMouseDown)
EVT_BUTTON( ID_QUERYPOS, MyCanvas::OnQueryPosition)
EVT_BUTTON( ID_ADDBUTTON, MyCanvas::OnAddButton)
EVT_BUTTON( ID_DELBUTTON, MyCanvas::OnDeleteButton)
m_button = new wxButton( this, ID_QUERYPOS, "Query position", wxPoint(10,110) );
- (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150) );
+ (void) new wxTextCtrl( this, -1, "wxTextCtrl", wxPoint(10,150), wxSize(80,-1) );
(void) new wxRadioButton( this, -1, "Disable", wxPoint(10,190) );
void MyCanvas::OnMouseDown( wxMouseEvent &event )
{
- wxPoint pt( event.GetPosition() );
- int x,y;
- CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
- wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y );
+ if (event.LeftDown())
+ {
+ wxPoint pt( event.GetPosition() );
+ int x,y;
+ CalcUnscrolledPosition( pt.x, pt.y, &x, &y );
+ wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y );
+ }
+
+ if (event.LeftIsDown() &&
+ event.LeftDown())
+ {
+ wxLogMessage( "Error: both LeftDown() and LeftIsDown() are TRUE!" );
+ }
}
void MyCanvas::OnPaint( wxPaintEvent &WXUNUSED(event) )