diff --git a/L7/nbproject/private/private.xml b/L7/nbproject/private/private.xml index 7945e41..1c8f059 100644 --- a/L7/nbproject/private/private.xml +++ b/L7/nbproject/private/private.xml @@ -6,6 +6,10 @@ - + + file:/home/user/Documents/published/L7/L7/LBoundGrid.cpp + file:/home/user/Documents/published/L7/L7/special/BaseGridPicker.h + file:/home/user/Documents/published/L7/L7/special/BaseGridPicker.cpp + diff --git a/L7/special/BaseGridPicker.cpp b/L7/special/BaseGridPicker.cpp index 2e7213d..0abd9fd 100644 --- a/L7/special/BaseGridPicker.cpp +++ b/L7/special/BaseGridPicker.cpp @@ -29,7 +29,6 @@ BaseGridPicker::BaseGridPicker(wxWindow *parent, m_intentLabel = _T("Intent"); m_nbInsertRows = 3; m_colTypeChoices = types; - m_PrefEditor = NULL; wxButton * btn = static_cast (GetPickerCtrl()); btn->Bind(wxEVT_COMMAND_BUTTON_CLICKED, &BaseGridPicker::ShowPopup, this); } @@ -175,22 +174,13 @@ void BaseGridPicker::PrepareGrid() m_stringTable->SetColLabelValue(1, _T("Type")); m_stringTable->SetColLabelValue(2, _T("Preferred")); m_stringTable->SetColLabelValue(3, _T("Notes")); - m_grid->Bind(wxEVT_GRID_EDITOR_CREATED, &BaseGridPicker::OnEditorCreated, this); - m_grid->Bind(wxEVT_GRID_EDITOR_HIDDEN, &BaseGridPicker::OnEditorHidden, this); + m_grid->Bind(wxEVT_GRID_CELL_CHANGED, &BaseGridPicker::OnPrefCellChanged, this); } -void BaseGridPicker::OnEditorCreated(wxGridEditorCreatedEvent& evt) +void BaseGridPicker::OnPrefCellChanged(wxGridEvent& evt) { - if (evt.GetCol() == 2) - { - m_PrefEditor = static_cast (evt.GetControl()); - } - evt.Skip(); -} - -void BaseGridPicker::OnEditorHidden(wxGridEvent& evt) -{ - if (evt.GetCol() == 2 && m_PrefEditor && m_PrefEditor->IsChecked()) + if (evt.GetCol() == 2 + && m_stringTable->GetValue(evt.GetRow(), evt.GetCol()) == _T("1")) { for (uint row = 0; row < m_stringTable->GetRowsCount(); row++) { diff --git a/L7/special/BaseGridPicker.h b/L7/special/BaseGridPicker.h index 12eb9ad..f54a3bf 100644 --- a/L7/special/BaseGridPicker.h +++ b/L7/special/BaseGridPicker.h @@ -138,7 +138,6 @@ private: wxArrayString m_colTypeChoices; wxString m_intentLabel; uint m_nbInsertRows; - wxCheckBox * m_PrefEditor; /** * Configures the Preferred column for editing and rendering using a * checkbox. @@ -155,20 +154,12 @@ private: * Binds the grid to editor creation and hidden events. */ void PrepareGrid(); - /** - * References the wxCheckBox editor. - *
- * Does nothing for the other columns. - * - * @param evt - */ - void OnEditorCreated(wxGridEditorCreatedEvent& evt); /** * Concerns the Preferred column only. When the editor is checked, ensures * the other rows are unchecked. * @param evt */ - void OnEditorHidden(wxGridEvent& evt); + void OnPrefCellChanged(wxGridEvent& evt); /** * Just calls BasePicker::DoShowPopup(). * @param evt