From 914cc63d3214fa438f2e0313164f41c95df28880 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Thu, 28 Jan 2021 19:13:09 +0100 Subject: [PATCH] Fix navigating through wxPropertyGrid with wxPG_ACTION_EDIT wxPG_ACTION_EDIT should not be considered done when wxPGProperty is not editable (i.e. is disabled, read-only, is a wxPropertyCategory) to prevent from blocking secondary actions (like wxPG_ACTION_NEXT_PROPERTY) in this case. Closes #19060. --- src/propgrid/propgrid.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 64ec7b55ff..8fa51de825 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -5733,8 +5733,12 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild ) if ( action == wxPG_ACTION_EDIT && !editorFocused ) { - DoSelectProperty( p, wxPG_SEL_FOCUS ); - wasHandled = true; + // Mark as handled only for editable property + if ( !p->IsCategory() && p->IsEnabled() && !p->HasFlag(wxPG_PROP_READONLY) ) + { + DoSelectProperty( p, wxPG_SEL_FOCUS ); + wasHandled = true; + } } // Travel and expand/collapse @@ -5774,10 +5778,10 @@ void wxPropertyGrid::HandleKeyEvent( wxKeyEvent &event, bool fromChild ) int selFlags = 0; int reopenLabelEditorCol = -1; - if ( editorFocused ) + if ( action == wxPG_ACTION_EDIT ) { - // If editor was focused, then make the next editor - // focused as well + // Make the next editor focused as well + // if we are actually going to edit the property. selFlags |= wxPG_SEL_FOCUS; } else