diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 1952fddaf7..47b8c8d08a 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -542,7 +542,10 @@ xaccRefreshHeader (Table *table) /* ==================================================== */ /* verifyCursorPosition checks the location of the cursor * with respect to a row/column position, and repositions - * the cursor if necessary. + * the cursor if necessary. This includes saving any uncomited + * data in the old cursor, and then oving the cursor and it's + * GUI. + * */ void diff --git a/src/register/table-gtk.c b/src/register/table-gtk.c index e644b95796..6d51fbdac0 100644 --- a/src/register/table-gtk.c +++ b/src/register/table-gtk.c @@ -172,6 +172,14 @@ verify_cell_interaction_OK(Table *table, const int row, const int col) int rel_row, rel_col; int invalid = 0; + /* make sure that we've repositioned the cursor to this location, + * and that we've dragged along any subsidiary GUI's with us. + * Do this *before* we use the value of the "current cursor" + */ + xaccVerifyCursorPosition (table, row, col); + + arr = table->current_cursor; + /* compute the cell location */ rel_row = table->locators[row][col]->phys_row_offset; rel_col = table->locators[row][col]->phys_col_offset; diff --git a/src/register/table-motif.c b/src/register/table-motif.c index ff616f2a36..887c23a223 100644 --- a/src/register/table-motif.c +++ b/src/register/table-motif.c @@ -153,12 +153,20 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) int invalid = 0; table = (Table *) cd; - arr = table->current_cursor; cbs = (XbaeMatrixDefaultActionCallbackStruct *) cb; row = cbs->row; col = cbs->column; + /* if we are entering this cell, make sure that we've + * moved the cursor, and that any subsidiary GUI elements + * properly positioned. Do this *before* we examine the + * value of the "cuirrent cursor". + */ + if (XbaeEnterCellReason == cbs->reason) { + xaccVerifyCursorPosition (table, row, col); + } + /* can't edit outside of the physical space */ invalid = (0 > row) || (0 > col) ; invalid = invalid || (row >= table->num_phys_rows); @@ -180,6 +188,7 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) invalid = invalid || (0 > rel_col); /* check for a cell handler, but only if cell adress is valid */ + arr = table->current_cursor; if (arr && !invalid) { if (! (arr->cells[rel_row][rel_col])) { invalid = TRUE; @@ -229,7 +238,6 @@ cellCB (Widget mw, XtPointer cd, XtPointer cb) * this cell. Dispatch for processing. */ switch (cbs->reason) { case XbaeEnterCellReason: { - xaccVerifyCursorPosition (table, row, col); enterCB (mw, cd, cb); break; } @@ -270,7 +278,8 @@ enterCB (Widget mw, XtPointer cd, XtPointer cb) rel_row = table->locators[row][col]->phys_row_offset; rel_col = table->locators[row][col]->phys_col_offset; -printf ("enter %d %d \n", row, col); +printf ("enter %d %d (rel=%d %d %p) %p\n", row, col, rel_row, rel_col, +arr->cells[rel_row][rel_col], arr ); /* since we are here, there must be a cell handler. * therefore, we accept entry into the cell by default,