documented Left[Is]Down behaviour and changed the obsolete test in the sample
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7609 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -9,6 +9,20 @@ drawbacks: the LEAVE\_WINDOW event might be received some time after the mouse
|
|||||||
left the window and the state variables for it may have changed during this
|
left the window and the state variables for it may have changed during this
|
||||||
time.
|
time.
|
||||||
|
|
||||||
|
{\bf NB: } Note the difference between methods like
|
||||||
|
\helpref{LeftDown}{wxmouseeventleftdown} and
|
||||||
|
\helpref{LeftIsDown}{wxmouseeventleftisdown}: the formet returns {\tt TRUE}
|
||||||
|
when the event corresponds to the left mouse button click while the latter
|
||||||
|
returns {\tt TRUE} if the left mouse button is currently being pressed. For
|
||||||
|
example, when the user is dragging the mouse you can use
|
||||||
|
\helpref{LeftIsDown}{wxmouseeventleftisdown} to test
|
||||||
|
whether the left mouse button is (still) depressed. Also, by convention, if
|
||||||
|
\helpref{LeftDown}{wxmouseeventleftdown} returns {\tt TRUE},
|
||||||
|
\helpref{LeftIsDown}{wxmouseeventleftisdown} will also return {\tt TRUE} in
|
||||||
|
wxWindows whatever the underlying GUI behaviour is (which is
|
||||||
|
platform-dependent). The same applies, of course, to other mouse buttons as
|
||||||
|
well.
|
||||||
|
|
||||||
\wxheading{Derived from}
|
\wxheading{Derived from}
|
||||||
|
|
||||||
\helpref{wxEvent}{wxevent}
|
\helpref{wxEvent}{wxevent}
|
||||||
|
@@ -188,12 +188,9 @@ void MyCanvas::OnMouseDown( wxMouseEvent &event )
|
|||||||
int x,y;
|
int x,y;
|
||||||
CalcUnscrolledPosition( pt.x, pt.y, &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 );
|
wxLogMessage( "Mouse down event at: %d %d, scrolled: %d %d", pt.x, pt.y, x, y );
|
||||||
}
|
|
||||||
|
|
||||||
if (event.LeftIsDown() &&
|
if ( !event.LeftIsDown() )
|
||||||
event.LeftDown())
|
wxLogMessage( "Error: LeftIsDown() should be TRUE if for LeftDown()" );
|
||||||
{
|
|
||||||
wxLogMessage( "Error: both LeftDown() and LeftIsDown() are TRUE!" );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user