From e9af6d6ec7f11de58bb3a27537d21ad9cde7e0e4 Mon Sep 17 00:00:00 2001 From: Artur Wieczorek Date: Mon, 11 Jul 2016 21:41:31 +0200 Subject: [PATCH] Fixed setting/unsetting wxPGProperty as read-only. Don't do any action only if property is exactly in the same state as required (and action is requested for single property only). --- src/propgrid/propgridiface.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/propgrid/propgridiface.cpp b/src/propgrid/propgridiface.cpp index 6085f50a22..ea19305d7f 100644 --- a/src/propgrid/propgridiface.cpp +++ b/src/propgrid/propgridiface.cpp @@ -284,8 +284,10 @@ void wxPropertyGridInterface::SetPropertyReadOnly( wxPGPropArg id, bool set, int } else { - // Do nothing if flag is already set. - if ( p->HasFlag(wxPG_PROP_READONLY) ) + // Do nothing if flag is already set as required. + if ( set && p->HasFlag(wxPG_PROP_READONLY) ) + return; + if ( !set && !p->HasFlag(wxPG_PROP_READONLY) ) return; p->ChangeFlag(wxPG_PROP_READONLY, set);