Here's two more minor fixes to the edit data grid.
First is related to the copy changes I recently made. Since I modified
the code to copy the cell the cursor is on if there is no highlight,
this change makes the Copy button in the toolbar enabled at all times.
The other is related to editing text cells. It looks like someone
half-implemented a check to only update the database if the contents of
the cell actually changed. This fix finishes that work. This
functionality was already in place for numeric cells.
Ed
Index: src/frm/frmEditGrid.cpp
===================================================================
--- src/frm/frmEditGrid.cpp (revision 4990)
+++ src/frm/frmEditGrid.cpp (working copy)
@@ -131,7 +131,7 @@
toolBar->Realize();
toolBar->EnableTool(MNU_SAVE, false);
toolBar->EnableTool(MNU_UNDO, false);
- toolBar->EnableTool(MNU_COPY, false);
+ toolBar->EnableTool(MNU_COPY, true);
toolBar->EnableTool(MNU_DELETE, false);
wxAcceleratorEntry entries[5];
@@ -663,7 +663,6 @@
}
}
toolBar->EnableTool(MNU_DELETE, enable);
- toolBar->EnableTool(MNU_COPY, enable);
}
event.Skip();
}
@@ -991,6 +990,7 @@
protected:
int textlen;
bool isMultiLine;
+ wxString m_startValue;
};
@@ -1015,6 +1015,7 @@
void sqlGridTextEditor::BeginEdit(int row, int col, wxGrid *grid)
{
+ m_startValue = grid->GetTable()->GetValue(row, col);
wxGridCellTextEditor::BeginEdit(row, col, grid);
((ctlSQLGrid*)grid)->ResizeEditor(row, col);
}
@@ -1024,7 +1025,9 @@
{
bool changed = false;
wxString value = Text()->GetValue();
- changed = true;
+
+ if (value != m_startValue)
+ changed = true;
if (changed)
grid->GetTable()->SetValue(row, col, value);