From e1a3e9212126ee0d0db5fce8584821d06f1864e1 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 12 Dec 2008 17:09:29 +0000 Subject: [PATCH] Patch level : 10.0 190 Files correlati : lv3.exe Ricompilazione Demo : [ ] Commento : Nagigazione guidata tra consgnato e ritirato nelle bolle di lavanderia git-svn-id: svn://10.65.10.50/trunk@17893 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/msksheet.cpp | 72 ++++++++++++++++++++++++++++++++++++++------ include/msksheet.h | 2 ++ lv/lv3100.cpp | 3 +- 3 files changed, 67 insertions(+), 10 deletions(-) diff --git a/include/msksheet.cpp b/include/msksheet.cpp index e1ab0d1d7..687467a96 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -142,6 +142,10 @@ class TSpreadsheet : public TControl bool _active; // @cmember:(INTERNAL) Indica se e' attivo l'auto append bool _auto_append; + // @cmember:(INTERNAL) Identificatore della prima colonna di navigazione + short _first_nav_column_id; + // @cmember:(INTERNAL) Identificatore dell' ultima colonna di navigazione + short _last_nav_column_id; // @cmember:(INTERNAL) Funzione per la gestione di una riga dello sheet (vedi ) SPREADSHEET_NOTIFY _notify; @@ -279,6 +283,8 @@ public: void delete_column(const int col) const; // @cmember Permette di attivare/ disattivare l'auto append void set_auto_append(bool on) { _auto_append = on;} + // @cmember Permette di attivare la navigazione tra due colonne con invio + void set_nav_column(short firstcol, short lastcol) { _first_nav_column_id = firstcol; _last_nav_column_id = lastcol; } // @cmember Permette di testare l'auto append bool auto_append() const { return _auto_append;} bool exist_column(const int col) const { return find_column(col) != NULL; } @@ -406,11 +412,12 @@ TSpreadsheet::TSpreadsheet( const char* head, // @parm Titolo delle colonne TSheet_field* o) // @parm Indica il campo della maschera che contiene lo spreadsheet : - _mask(), _active(TRUE), _notify(NULL), + _mask(), _active(true), _notify(NULL), _edit_field(NULL), _cur_row(0), _cur_rec(0), _cur_col(1), - _row_dirty(FALSE), _cell_dirty(FALSE), _check_enabled(TRUE), - _needs_update(-1), _selection_posted(-1), _save_columns_order(FALSE), - _f9_target(NULL), _auto_append(false) + _row_dirty(false), _cell_dirty(false), _check_enabled(TRUE), + _needs_update(-1), _selection_posted(-1), _save_columns_order(false), + _f9_target(NULL), _auto_append(false), _first_nav_column_id(-1), + _last_nav_column_id(-1) { int m_width[MAX_COL], v_width[MAX_COL]; int fixed_cols = 0; // Number of fixed columns @@ -1356,6 +1363,19 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) break; } + if (ENTER_AS_TAB && _first_nav_column_id > 0) + { + const int fcol = cid2col(_first_nav_column_id); + const int lcol = cid2col(_last_nav_column_id); + const int mcol = min(fcol, lcol); + + if (_cur_col != mcol) + { + _cur_col = mcol; + set_focus_cell(xiev->v.xi_obj->v.row, _cur_col); + } + } + // Setta _cur_rec in base a alla riga e cella correnti set_pos(xiev->v.xi_obj->v.row, _cur_col); if (_cur_rec < items() && notify(_cur_rec, K_TAB)) @@ -1731,12 +1751,33 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) case K_SHIFT+K_ENTER: { const int dir = k == K_ENTER ? +1 : -1; - if (ENTER_AS_TAB) + + if (ENTER_AS_TAB) { int next_col = find_enabled_column(_cur_rec, _cur_col+dir, dir); while (next_col > 0 && col2field(next_col)->is_kind_of(CLASS_BOOLEAN_FIELD)) next_col = find_enabled_column(_cur_rec, next_col+dir, dir); + if (_first_nav_column_id > 0) + { + const int fcol = cid2col(_first_nav_column_id); + const int lcol = cid2col(_last_nav_column_id); + + if (k == K_ENTER) + { + const int mcol = max(fcol, lcol); + + if (next_col > mcol) + next_col = -1; + } + else + { + const int mcol = min(fcol, lcol); + + if (next_col < mcol) + next_col = _cur_col + 1; + } + } if (next_col != 0 && next_col != _cur_col && ((next_col>_cur_col)^(dir < 0))) { dispatch_e_char(parent(), k == K_ENTER ? K_TAB : K_BTAB); @@ -1745,6 +1786,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) } if (!refused) { + if (ENTER_AS_TAB && _first_nav_column_id > 0) + { + const int fcol = cid2col(_first_nav_column_id); + const int lcol = cid2col(_last_nav_column_id); + + _cur_col = min(fcol, lcol); + } if (_auto_append && k == K_ENTER && _cur_row == items() - 1) { dispatch_e_char(parent(), K_DOWN); @@ -2463,9 +2511,9 @@ bool TSpreadsheet::add_row_auto() // Certified 100% TSheet_field::TSheet_field(TMask* m) - : TLoadable_field(m), _append(TRUE), - _separator('|'), _enable_autoload(FALSE), _sheetfile(NULL), - _linee_rec(NULL), _external_record(FALSE), _userput(NULL),_userget(NULL) + : TLoadable_field(m), _append(true), + _separator('|'), _enable_autoload(false), _sheetfile(NULL), + _linee_rec(NULL), _external_record(false), _userput(NULL),_userget(NULL) { } @@ -2744,6 +2792,12 @@ void TSheet_field::set_auto_append(bool on) s->set_auto_append(on); } +void TSheet_field::set_nav_column(short firstcol, short lastcol) +{ + TSpreadsheet* s = (TSpreadsheet*)_ctl; + s->set_nav_column(firstcol, lastcol); +} + bool TSheet_field::enabled() const { // return items() > 0; @@ -3155,7 +3209,7 @@ void TSheet_field::check_row(int n, int mode) s->_cur_rec = n; - TMask& m = sheet_mask(); + TMask& m = sheet_row_mask(n); CHECK(!m.is_running(), "Can't use check_row while sheet mask is running"); TToken_string & r = row(n); const int max = m.fields(); diff --git a/include/msksheet.h b/include/msksheet.h index 8dcf85d52..f7112b56a 100755 --- a/include/msksheet.h +++ b/include/msksheet.h @@ -259,6 +259,8 @@ public: { _append = on;} // @cmember Permette di attivare/ disattivare l'auto append void set_auto_append(bool on = true); + // @cmember Permette di attivare la navigazione tra due colonne con invio + void set_nav_column(short firstcol, short lastcol); // @cmember Ritorna il valore del membro

bool append() const diff --git a/lv/lv3100.cpp b/lv/lv3100.cpp index fddf46b9a..c1de277f4 100755 --- a/lv/lv3100.cpp +++ b/lv/lv3100.cpp @@ -21,7 +21,8 @@ protected: public: virtual void user_set_handler( short fieldid, int index); virtual void user_set_row_handler(TMask& rm, short field, int index); - TGestione_bolle_msk(const char* tipodoc) : TDocumento_mask(tipodoc) {} + TGestione_bolle_msk(const char* tipodoc) : TDocumento_mask(tipodoc) { sfield(F_SHEET).set_nav_column(FR_QTA, FR_QTAGG1); +} }; void TGestione_bolle_msk::arrotonda(const TMask& msk, real& quantita)