Need to handle wxEVT_MOUSE_CAPTURE_LOST in wxGrid subwindow?

Knut P. Lehre knutpl at broadpark.no
Fri Mar 2 23:41:22 PST 2007


This message was first sent to the wx-users list, but was moved to wx-dev.

VZ> You shouldn't have to handle the mouse lost event resulting from the mouse
VZ>capture done by wxGrid itself, the control should do it on its own. If you
VZ>can still reproduce the bug with wx 2.8.2-rc1 please let us know about how
VZ>exactly can it be seen.

I havent tested 2.8.2 yet, but look in CVS at grid.cpp rev 1417:
BEGIN_EVENT_TABLE( wxGridWindow, wxWindow )
    EVT_PAINT( wxGridWindow::OnPaint )
    EVT_MOUSEWHEEL( wxGridWindow::OnMouseWheel )
    EVT_MOUSE_EVENTS( wxGridWindow::OnMouseEvent )
    EVT_KEY_DOWN( wxGridWindow::OnKeyDown )
    EVT_KEY_UP( wxGridWindow::OnKeyUp )
    EVT_CHAR( wxGridWindow::OnChar )
    EVT_SET_FOCUS( wxGridWindow::OnFocus )
    EVT_KILL_FOCUS( wxGridWindow::OnFocus )
    EVT_ERASE_BACKGROUND( wxGridWindow::OnEraseBackground )
END_EVENT_TABLE()

If wxGridWindow captures the mouse (see example in wxGrid::ChangeCursorMode() which
contains a "win = m_gridWin;" followed later by a "win->CaptureMouse();"), why is there
no EVT_MOUSE_CAPTURE_LOST handler? Is this a bug?
Adding this patch to 2.8.0 prevents the assertion error message in my app:

Index: grid.cpp
===================================================================
RCS file: /pack/cvsroots/wxwidgets/wxWidgets/src/generic/grid.cpp,v
retrieving revision 1.417
diff -r1.417 grid.cpp
223a224
>     void OnMouseCaptureLost( wxMouseCaptureLostEvent &event ){}
3987a3989
>     EVT_MOUSE_CAPTURE_LOST( wxGridWindow::OnMouseCaptureLost )


KPL





More information about the wx-dev mailing list