Allow user code to override key events in generic wxListCtrl.

The changes of r58323 ("Restore keyboard navi") fixed the handling of cursor
keys in the generic wxListCtrl implementation but at the price of not sending
keyboard events for the cursor keys to wxListCtrl itself any more. This made
it impossible to override their handling in user code, something that used to
work in previous wx versions and still works in wxMSW.

Revert the changes of this revision now and fix the original code by simply
disabling the handling of the cursor keys in wxScrollHelperBase using a newly
added DisableKeyboardScrolling() method. This ensures that the keyboard events
for cursor keys are not used to scroll the window when they are forwarded to
wxListCtrl from wxListMainWindow.

The fix is conceptually ugly as it would be better to avoid the need for such
ad hoc functions as DisableKeyboardScrolling() but it is very simple and there
just doesn't seem to be any sane way to do it otherwise with wxScrollHelperBase.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64877 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2010-07-11 10:43:35 +00:00
parent 6794ca461c
commit d6a658ff0c
4 changed files with 47 additions and 15 deletions

View File

@@ -199,6 +199,22 @@ public:
long style = wxHSCROLL | wxVSCROLL,
const wxString& name = "scrolledWindow");
/**
Disable use of keyboard keys for scrolling.
By default cursor movement keys (including Home, End, Page Up and Down)
are used to scroll the window appropriately. If the derived class uses
these keys for something else, e.g. changing the currently selected
item, this function can be used to disable this behaviour as it's not
only not necessary then but can actually be actively harmful if another
object forwards a keyboard event corresponding to one of the above keys
to us using ProcessWindowEvent() because the event will always be
processed which can be undesirable.
@since 2.9.1
*/
void DisableKeyboardScrolling();
/**
Call this function to prepare the device context for drawing a scrolled
image.