wxWidgets icon indicating copy to clipboard operation
wxWidgets copied to clipboard

wxDataViewCtrl consumes mouse-move event (win32)

Open basiliscos opened this issue 1 year ago • 7 comments

Description

We'd like to hi-light the item under mouse. It works fine on linux/gtk, but does not on windows.

Expected vs observed behaviour:

wxDataViewCtrl* view;
...
view->Bind(wxEVT_MOTION, &Panel::OnMouseMove, this);

the callback in invoked on linux, but non on windows.

Platform and version information

wxWidgets-3.2.5 (MSW)

basiliscos avatar Aug 26 '24 09:08 basiliscos

Have you tried binding to the event on view->GetMainWindow()?

vadz avatar Aug 26 '24 12:08 vadz

Thank you, it works, indeed. However, then wxEVT_LEAVE_WINDOW cannot be catch via it (it works on windows, and does not work on linux)

basiliscos avatar Aug 26 '24 13:08 basiliscos

Under Linux GetMainWindow() is the same thing as wxDataViewCtrl itself, so do you mean that wxEVT_LEAVE_WINDOW doesn't work at all for you with wxGTK?

vadz avatar Aug 26 '24 13:08 vadz

sample.cpp.txt

Here is a minimal example. On windows it prints "leaving" in the console, while on linux/gtk it is silent.

basiliscos avatar Aug 26 '24 13:08 basiliscos

What I mean is that removing GetMainWindow() from this example probably doesn't make it work neither. So it's a rather different problem from the one originally reported and which, I suspect, might not even be specific to wxDVC.

vadz avatar Aug 26 '24 13:08 vadz

well, while this can be different problem from wx perspective, I solve the following problem: hilight an item while mouse is hovering over it, i.e. when mouse is moving around hilight an item and unhilight previous, and when mouse is leaving the area, then unhilight last item.

I'd expect just to do 2 binds (mouse move and mouse leaving) and implement that.

basiliscos avatar Aug 26 '24 14:08 basiliscos

Anyway, thank as a lot for helping. The GetMainWindow() solves half of the my problem!

basiliscos avatar Aug 26 '24 14:08 basiliscos