diff --git a/src/register/combocell.c b/src/register/combocell.c index 34e811aa29..97679b84cc 100644 --- a/src/register/combocell.c +++ b/src/register/combocell.c @@ -211,9 +211,20 @@ xaccSetComboCellValue (ComboCell *cell, const char * str) } else { XmComboBoxClearItemSelection (box->combobox); } + + if ((0 < box->currow) && (0 < box->curcol)) { + /* be sure to set the string into the matrix widget as well, + * so that we don't end up blanking out the cell when we + * unmap the combobox widget */ + XbaeMatrixSetCell (box->parent, box->currow, box->curcol, (char *) str); + } } else { XmComboBoxClearItemSelection (box->combobox); + if ((0 < box->currow) && (0 < box->curcol)) { + XbaeMatrixSetCell (box->parent, box->currow, box->curcol, ""); + } } + } /* =============================================== */ @@ -313,7 +324,6 @@ void moveCombo (BasicCell *bcell, int phys_row, int phys_col) { ComboCell *cell; PopBox *box; - cell = (ComboCell *) bcell; box = (PopBox *) (cell->cell.gui_private); @@ -448,6 +458,9 @@ static void selectCB (Widget w, XtPointer cd, XtPointer cb ) return; } + /* be sure to set the string into the matrix widget as well, + * so that we don't end up blanking out the cell when we + * unmap the combobox widget */ XbaeMatrixSetCell (box->parent, box->currow, box->curcol, choice); SET (&(cell->cell), choice); XtFree (choice); diff --git a/src/register/table-allgui.c b/src/register/table-allgui.c index 554d06a485..8aea2ab651 100644 --- a/src/register/table-allgui.c +++ b/src/register/table-allgui.c @@ -439,13 +439,18 @@ void xaccMoveCursorGUI (Table *table, int new_phys_row, int new_phys_col) cell = curs->cells[i][j]; if (cell) { char * cell_val = table->entries[i+phys_row_origin][j+phys_col_origin]; - xaccSetBasicCellValue (cell, cell_val); - cell->changed = 0; - - /* if a cell has a GUI, move that too */ + /* if a cell has a GUI, move that first, before setting + * the cell value. Otherwise, we'll end up putting the + * new values in the old cell locations, and that would + * lead to confusion of all sorts. */ if (cell->move) { (cell->move) (cell, i+phys_row_origin, j+phys_col_origin); } + + /* OK, now set the cell value, after the move */ + xaccSetBasicCellValue (cell, cell_val); + cell->changed = 0; + } } } @@ -546,7 +551,7 @@ xaccVerifyCursorPosition (Table *table, int phys_row, int phys_col) if ((virt_row != table->current_cursor_virt_row) || (virt_col != table->current_cursor_virt_col)) { - /* before leaving, the current virtual position, + /* before leaving the current virtual position, * commit any edits that have been accumulated * in the cursor */ xaccCommitCursor (table);