From: Vadim Zeitlin Date: Tue, 10 Jan 2012 23:11:39 +0000 (+0000) Subject: Fix UI in generic wxListCtrl when pressing cursor arrows while editing. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/29686ebc000a1d95ae56a58b9ff2a5a6f23eed84 Fix UI in generic wxListCtrl when pressing cursor arrows while editing. Pressing Up/Down keys while editing an item changed the selection but left the in-place editing control on the previously selected item which was just wrong. Ignore these keys to avoid it. Notice that there is an underlying bug somewhere in wxGTK because we shouldn't be getting these events in the first place while the in-place editing text control has focus but it doesn't seem easy to fix so work around it here. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70315 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index f95abdb06f..ddd950997a 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -2754,6 +2754,18 @@ void wxListMainWindow::OnCharHook( wxKeyEvent &event ) void wxListMainWindow::OnChar( wxKeyEvent &event ) { +#ifdef __WXGTK__ + // Under GTK we get some keys (notably cursor arrows) even while the in + // place editing control is shown. Processing them here results in UI + // problems, e.g. we could change the current item on WXK_DOWN press but + // the edit control would remain on the item above. So we need to either + // cancel in-place editing or ignore any such keys while it's active. To + // avoid aggravating the user by losing his changes just because a cursor + // arrow key was mistakenly pressed, do nothing in this case. + if ( m_textctrlWrapper ) + return; +#endif // __WXGTK__ + wxWindow *parent = GetParent(); // propagate the char event upwards