diff --git a/include/mov.h b/include/mov.h index 0e74ffa72..995be9d9a 100755 --- a/include/mov.h +++ b/include/mov.h @@ -11,6 +11,8 @@ #define MOV_NUMDOC "NUMDOC" #define MOV_TIPODOC "TIPODOC" #define MOV_TOTDOC "TOTDOC" +#define MOV_RITFIS "RITFIS" +#define MOV_RITSOC "RITSOC" #define MOV_CODCAUS "CODCAUS" #define MOV_DESCR "DESCR" #define MOV_TIPOMOV "TIPOMOV" diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 4a97d3b48..6f52efb15 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -76,6 +76,8 @@ class TSpreadsheet : public TWindow int _cur_col; // @cmember Indica se la riga corrente e' stat modificata bool _row_dirty; + // @cmember Indica se la cella corrente e' stat modificata + bool _cell_dirty; // @cmember Permette di gestire i check OFF_ROW e OFF_CELL bool _check_enabled; // @cmember Numero della riga che necessita aggiornamento (vengono aggiornate @@ -209,7 +211,7 @@ public: int selected() const { return _cur_rec; } // @cmember Seleziona una riga dandogli il focus - void select(int r); + void select(int r, bool scrollto); // @cmember Ritorna il numero di colonne presenti enllo spreadsheet int columns() const { return _columns; } @@ -436,12 +438,13 @@ TSpreadsheet::TSpreadsheet( set_win(win); // Set TWindow::_win itfdef->v.itf->win = win; // Link interface to win - - xi_create(XI_NULL_OBJ, itfdef); // Create the whole thing! - xi_tree_free(itfdef); // Free definitions - - _itf = xi_get_itf(win); // Store useful references for later use + + // Create the whole thing! + _itf = xi_create(XI_NULL_OBJ, itfdef); _list = xi_get_obj(_itf, LIST_CID); + + xi_dequeue(); // Flush events + xi_tree_free(itfdef); // Free definitions } TSpreadsheet::~TSpreadsheet() @@ -713,18 +716,24 @@ bool TSpreadsheet::destroy( // @mfunc Modifica a video la riga void TSpreadsheet::update( - int row) // @parm Numero della riga da modificare + int rec) // @parm Numero della riga da modificare // @comm Se il valore di

e' minore di 0 viene aggiornato l'intero spreadsheet { - if (row < 0) + if (rec < 0) { _needs_update = -1; // Clear pending row update - xi_cell_request(_list); // Force updatde - xi_scroll(_list, XI_SCROLL_FIRST); + xi_cell_request(_list); // Update cell values + + int num; + const long* handles = xi_get_list_info(_list, &num); + if (num == 0 || !_owner->mask().is_running()) + xi_scroll(_list, XI_SCROLL_FIRST); + else + xi_scroll_rec(_list, *handles, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); } else - update_rec(row); + update_rec(rec); } @@ -780,7 +789,9 @@ bool TSpreadsheet::off_cell_handler(XI_OBJ *cell) { const char* nuo = copy_cell2field(cell); if (_edit_field->on_key(_edit_field->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it - ok = *nuo != '\0'; + ok = *nuo != '\0'; + else + _cell_dirty = FALSE; mask2str(_cur_rec); // Update sheet row } return ok; @@ -790,7 +801,6 @@ bool TSpreadsheet::off_cell_handler(XI_OBJ *cell) void TSpreadsheet::list_handler(XI_EVENT *xiev) { static KEY _lastab = K_TAB; - static bool _cell_dirty; switch (xiev->type) { @@ -1204,16 +1214,19 @@ void TSpreadsheet::activate(bool on) } } -void TSpreadsheet::select(int rec) +void TSpreadsheet::select(int rec, bool scrollto) { - int row = rec2row(rec); - if (row < 0) - { + int first = 0, last = 0; + if (!scrollto) + xi_get_visible_rows(_list, &first, &last); + + if (scrollto || rec < first || rec > last) xi_scroll_rec(_list, rec, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); - row = 0; - } + + const int row = rec2row(rec); _cur_rec = -1; set_focus_cell(row, 1); + notify(rec, K_TAB); } void TSpreadsheet::on_idle() @@ -2025,9 +2038,13 @@ bool TSheet_field::on_hit() return TRUE; } -void TSheet_field::select(int r) +void TSheet_field::select(int r, bool scrollto) { +#if XVT_OS == XVT_OS_WIN + _sheet->select(r, scrollto); +#else _sheet->select(r); +#endif } diff --git a/include/msksheet.h b/include/msksheet.h index 516e0d175..b3241ffca 100755 --- a/include/msksheet.h +++ b/include/msksheet.h @@ -73,7 +73,7 @@ public: // @cmember Ritorna il numero della riga corrente int selected() const; // @cmember Seleziona la riga

come quella corrente - void select(int r); + void select(int r, bool scrollto = FALSE); // @cmember Vuota tutto lo spreadsheet virtual void reset(); diff --git a/include/rmov.h b/include/rmov.h index 1b1300282..9b8e59887 100755 --- a/include/rmov.h +++ b/include/rmov.h @@ -16,6 +16,7 @@ #define RMV_GRUPPOC "GRUPPOC" #define RMV_CONTOC "CONTOC" #define RMV_SOTTOCONTOC "SOTTOCONTC" +#define RMV_ROWTYPE "ROWTYPE" // To be removed soon #define RMV_RCONTR "RCONTR"