How to get the event when combobox option is selected or changed in wxGrid? Topic is solved

If you are using the main C++ distribution of wxWidgets, Feel free to ask any question related to wxWidgets development here. This means questions regarding to C++ and wxWidgets, not compile problems.
Post Reply
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

How to get the event when combobox option is selected or changed in wxGrid?

Post by nandakishore »

Hi,
I have wxGrid, in that for one cell there is a customized combobox.
like below

Code: Select all

wxString strFirstChoices[3] = { "Continuous", "Discrete", "Design Path" };
m_grid->SetCellRenderer(m_iRowCounter, 7, new wxGridCellChoiceRenderer);
m_grid->SetCellEditor(m_iRowCounter, 7, new wxFastComboEditor(3, strFirstChoices, true));
m_grid->SetCellValue(m_iRowCounter, 7, strFirstChoices[0]);
Now i have a situation that i need to get event when combo box option is selected.
is there a way to do this?
Last edited by nandakishore on Wed May 31, 2017 6:38 am, edited 1 time in total.
Got a Problem???..No worry..Focus on Solution not on Problem :P
User avatar
doublemax
Moderator
Moderator
Posts: 19116
Joined: Fri Apr 21, 2006 8:03 pm
Location: $FCE2

Re: How to get the event when combobox option is selected or changed in wxGrid?

Post by doublemax »

I'm not sure if that's what you mean but you'll receive a wxEVT_GRID_CELL_CHANGING event when the editor is closed and the cell value was changed.

If wxFastComboEditor is a custom control, you can just catch it inside the control. ( I can't tell how exactly, because i don't know the control).
Use the source, Luke!
nandakishore
Experienced Solver
Experienced Solver
Posts: 57
Joined: Wed Feb 25, 2015 2:09 pm
Location: Chennai, India

Re: How to get the event when combobox option is selected or changed in wxGrid?

Post by nandakishore »

Thanks man .
I used it like below. it worked.

Code: Select all

m_grid->Connect(wxEVT_GRID_CELL_CHANGING, wxGridEventHandler(MyClass::OnCellChanged), NULL, this);
OnCellChanged(wxGridEvent& event)
Got a Problem???..No worry..Focus on Solution not on Problem :P
Post Reply