Just FYI - I couldn’t get the position, so I went back and made a custom component to stick in the cell.
In short - I keep row and col of the currently editing cell, on return component, that cell gets an editor.
when another row is selected or double-clicked then another editor is created. One thing that doesn’t feel quite right - when returning a zero component, I delete any found text editor found. It seems to work, and why would you need two editors? Don’t know. AnywaY, it works.
[code]void SourceTableComponent::cellDoubleClicked(int rowNumber, int columnId, const MouseEvent & e)
// Is it one of the editable columns?
if (columnId == SourceColumns::sourceID ||
columnId == SourceColumns::name ||
(columnId == SourceColumns::input && getConnection(rowNumber, SourceColumns::connection) <= 1000) ||
columnId == SourceColumns::tally ||
columnId == SourceColumns::config)
rowBeingEdited = rowNumber;
colBeingEdited = columnId;
table->updateContent(); // Force a redraw, now with a new edit field
void SourceTableComponent::selectedRowsChanged(int lastRowselected)
if (rowBeingEdited != -1 && lastRowselected != rowBeingEdited)
rowBeingEdited = -1;
colBeingEdited = -1;
table->updateContent(); // Force a redraw, edit field will be released
Component* SourceTableComponent::refreshComponentForCell (int rowNumber, int columnId, bool isRowSelected,
if (columnId == SourceColumns::thumbnail) // we’ll return our custom component…
// If we have a text editor, but don’t need it, get rid of it
InplaceEditorComponent* textField = dynamic_cast<InplaceEditorComponent*> (existingComponentToUpdate);
existingComponentToUpdate = 0;
// for any other column, just return 0, as we'll be painting these columns directly.
jassert (existingComponentToUpdate == 0);