I’m getting a strange effect when I exchange the table base while an
editor is active. The edit control would stay active and it would be
impossible to remove it from the GUI.
Here’s how my app works:
There is a tree structure that allows selection of a group of parameters
to display in the grid. When the user clicks an entry in the tree, I run
the following code snippet:
The strange part happens when the opens a cell editor and, while the
editor is open, changes the tree selection.
In that case, the grid would change its table base but the open cell
editor would remain open until the program quits.
My question is, how can I ‘automatically’ close any open editors on a
grid if the user decides to change the underlying table?
The base class Wx::GridCellEditor has a method #end_edit which IIRC
dismisses the current editor - does this help? You may need to track
where there is a current editor with the various event hooks in Wx::GRid
just to let you know how things turned out. Briefly speaking, disabling
editing and the cell_edit_controls does the trick.
Here’s the long version:
The base class Wx::GridCellEditor has a method #end_edit which IIRC
dismisses the current editor - does this help? You may need to track
where there is a current editor with the various event hooks in Wx::GRid
I tried that but it seems that the editor isn’t affected by that. What I
did is, I was tracking the active editor in @arow & @acol using the
grid_editor_shown/hidden events. That worked fine.