* Fix a bug with not escaped characters

* Use GetLastRowId instead of doing another SQL request
* Handle request failling
* Fix a bug, wxGridCellFastBoolEditor crashes when deleted
This commit is contained in:
2010-09-05 12:08:48 +02:00
parent 0456397fc8
commit fc0159fbc5
9 changed files with 265 additions and 276 deletions

View File

@@ -24,6 +24,11 @@
SetCellBackgroundColour(row, i, color); \
}
#define UNESCAPE_CHARS(s) { \
s.Replace(wxT("\\\""), wxT("\""), true); \
s.Replace(wxT("\\\'"), wxT("\'"), true); \
}
BEGIN_EVENT_TABLE(GridAccount, wxGrid)
EVT_GRID_CELL_LEFT_CLICK(GridAccount::OnCellLeftClick )
END_EVENT_TABLE()
@@ -111,6 +116,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
int r, g, b;
wxColour color;
wxDateTime curDate;
wxString description;
curDate.SetToCurrent();
@@ -134,7 +140,9 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
if (op)
{
SetCellEditor(line, DATE, new CalendarEditor(op->day, op->month, op->year));
SetCellValue(line, DESCRIPTION, op->description);
description = op->description;
UNESCAPE_CHARS(description);
SetCellValue(line, DESCRIPTION, description);
SetCellValue(line, DATE, wxString::Format(wxT("%02d/%02d/%d"), op->day+1, op->month+1, op->year));
if (op->amount < 0)
SetCellValue(line, DEBIT, wxString::Format(wxT("%.2lf"), -op->amount));
@@ -144,7 +152,7 @@ void GridAccount::InsertOperation(User* user, Operation* op, int line, bool fix,
if (!fix)
SetCellValue(line, CATEGORY, user->GetCategoryName(op->category));
SetCellRenderer(line, DELETE, new wxGridCellBoolRenderer ());
SetCellEditor(line, DELETE, new wxGridCellFastBoolEditor ());
SetCellEditor(line, DELETE, new wxGridCellBoolEditor ());
SetCellRenderer(line, CHECKED, new wxGridCellBoolRenderer ());
SetCellEditor(line, CHECKED, new wxGridCellFastBoolEditor ());

View File

@@ -12,7 +12,7 @@ public:
void BeginEdit (int row, int col, wxGrid* grid)
{
wxGridCellBoolEditor::BeginEdit(row, col, grid);
wxFocusEvent event (wxEVT_KILL_FOCUS);
if (m_control)
{