From f4b56f67ec3168d8b2cca7310dd4679a7c67a95b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Bron?= Date: Wed, 27 Dec 2017 16:56:50 +0100 Subject: [PATCH] Improve documentation of wxPropertyGrid::MakeColumnEditable() Explain that column must be different from 1 in the documentation and in the (already existing) assert checking it. Closes https://github.com/wxWidgets/wxWidgets/pull/656 --- interface/wx/propgrid/propgrid.h | 4 ++++ src/propgrid/propgrid.cpp | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/interface/wx/propgrid/propgrid.h b/interface/wx/propgrid/propgrid.h index 226533c21c..2e7bf51563 100644 --- a/interface/wx/propgrid/propgrid.h +++ b/interface/wx/propgrid/propgrid.h @@ -942,6 +942,10 @@ public: @param editable Using @false here will disable column from being editable. + Note that @a column must not be equal to 1, as the second column is + always editable and can be made read-only only on cell-by-cell basis + using @code wxPGProperty::ChangeFlag(wxPG_PROP_READONLY, true) @endcode + @see BeginLabelEdit(), EndLabelEdit() */ void MakeColumnEditable( unsigned int column, bool editable = true ); diff --git a/src/propgrid/propgrid.cpp b/src/propgrid/propgrid.cpp index 6ced9091b7..3bc9611f1a 100644 --- a/src/propgrid/propgrid.cpp +++ b/src/propgrid/propgrid.cpp @@ -964,7 +964,13 @@ void wxPropertyGrid::DoSetSelection( const wxArrayPGProperty& newSelection, void wxPropertyGrid::MakeColumnEditable( unsigned int column, bool editable ) { - wxASSERT( column != 1 ); + // The second column is always editable. To make it read-only is a property + // by property decision by setting its wxPG_PROP_READONLY flag. + wxASSERT_MSG + ( + column != 1, + wxS("Set wxPG_PROP_READONLY property flag instead") + ); wxArrayInt& cols = m_pState->m_editableColumns;