wxWidgets / Phoenix

wxPython's Project Phoenix. A new implementation of wxPython, better, stronger, faster than he was before.
http://wxpython.org/
2.29k stars 515 forks source link

On OSX dv.EVT_DATAVIEW_ITEM_ACTIVATED is not triggered by the enter key. #640

Open daniel-kg opened 6 years ago

daniel-kg commented 6 years ago

Operating system: OSX 10.12.6 wxPython version: 4.0.0b2 Stock or custom build: Stock Python version: 2.7 Stock or custom build: Stock

Description of the problem:

When an item is selected and the enter key is hit the event dv.EVT_DATAVIEW_ITEM_ACTIVATED is not triggered. An event on the same item can be triggered by double clicking. Attached is a light modified version of DataViewModel.py from 'samples\ that shows the problem. On receiving the event it will print 'event_happened' followed by the event.

example.zip

RobinD42 commented 6 years ago

Unfortunately the DVC on OSX does not fully implement the documented API. This is due to using native widgets for the platform and a mismatch between what they can do and what the DVC is supposed to provide. The activation event on the Enter keypress is one of those things that is missing.

I hope that one day we would be able to provide the generic DVC (currently used only on Windows) for all platforms, so there will be an option for those cases when you need a feature that the native widget is not able to support.

ctoth commented 6 years ago

I currently use a dataview because of the native implementation, it's the only thing I can be sure will work with VoiceOver. If we are using an NSTableView to implement the native portion of the control, it should absolutely be possible to bind the Return key. This will involve doing something with the NSTextFieldCell and some magic with delegates, but it absolutely does not look impossible. Here's someone doing it in 2001? http://www.cocoabuilder.com/archive/cocoa/27215-keyboard-input-from-nstableview.html