I have a wxGrid object.
One of the cells has an attached wxChoiceCellEditor (which is wxComboBox).
What I'd like to do is show the editor and when the user make a selection and the editor closes - if the user chooses the specific string reset the cell value back to empty string.
So I have the following code:
Code: Select all
void MyDialog::OnCellLeftClicked(wxGridEvent &event)
{
auto row = event.GetRow();
auto column = event.GetCol();
if( row == 1 )
{
m_grid->ShowCellEditControl();
wxGridCellChoiceEditor *editor = (wxGridCellChoiceEditor *) m_grid->GetCellEditor( row, column );
wxComboBox *combo = (wxComboBox *) editor->GetControl();
//
combo->Bind( wxEVT_COMBOBOX_CLOSEUP, &QuickSelect::OnSortClosing, this );
//
wxString value = m_grid->GetCellValue( row, column );
combo->Popup();
editor->DecRef();
m_column = column;
}
}
void QuickSelect::OnSortClosing(wxCommandEvent &event)
{
wxComboBox *object = wxDynamicCast( event.GetEventObject(), wxComboBox );
if( object->GetStringSelection() == _( "(not sorted)" ) )
{
m_grid->SetCellValue( 1, m_column, "" );
}
}
I tried to use CallAfter, like this:
Code: Select all
CallAfter( &m_grid->SetCellValue/*( 1, m_column, "" )*/, 1, m_column, "" );
Is there a workaround?error C2276: '&': illegal operation on bound member function expression
Thank you.