/**
Makes given column editable by user.
- @see BeginLabelEdit(), EndLabelEdit()
+ @param editable
+ Using @false here will disable column from being editable.
*/
- void MakeColumnEditable( unsigned int column )
- {
- wxASSERT( column != 1 );
- m_pState->m_editableColumns.push_back(column);
- }
+ void MakeColumnEditable( unsigned int column, bool editable = true );
/**
Creates label editor wxTextCtrl for given column, for property
/**
Makes given column editable by user.
+ @param editable
+ Using @false here will disable column from being editable.
+
@see BeginLabelEdit(), EndLabelEdit()
*/
- void MakeColumnEditable( unsigned int column );
+ void MakeColumnEditable( unsigned int column, bool editable = true );
/**
It is recommended that you call this function any time your code causes
RT_ASSERT( !pg->IsPropertySelected(prop3) )
}
+ {
+ //
+ // Test label editing
+ RT_START_TEST(LABEL_EDITING)
+
+ wxPropertyGrid* pg = pgman->GetGrid();
+
+ // Just mostly test that these won't crash
+ pg->MakeColumnEditable(0, true);
+ pg->MakeColumnEditable(2, true);
+ pg->MakeColumnEditable(0, false);
+ pg->MakeColumnEditable(2, false);
+ pg->SelectProperty(wxT("Height"));
+ pg->BeginLabelEdit(0);
+ pg->BeginLabelEdit(0);
+ pg->EndLabelEdit(0);
+ pg->EndLabelEdit(0);
+
+ // Recreate grid
+ CreateGrid( -1, -1 );
+ pgman = m_pPropGridManager;
+ }
+
{
RT_START_TEST(Attributes)
// -----------------------------------------------------------------------
+void wxPropertyGrid::MakeColumnEditable( unsigned int column,
+ bool editable )
+{
+ wxASSERT( column != 1 );
+
+ wxArrayInt& cols = m_pState->m_editableColumns;
+
+ if ( editable )
+ {
+ cols.push_back(column);
+ }
+ else
+ {
+ for ( int i = cols.size() - 1; i > 0; i-- )
+ {
+ if ( cols[i] == (int)column )
+ cols.erase( cols.begin() + i );
+ }
+ }
+}
+
+// -----------------------------------------------------------------------
+
void wxPropertyGrid::DoBeginLabelEdit( unsigned int colIndex,
int selFlags )
{