diff --git a/cg/cg0200.cpp b/cg/cg0200.cpp index 428708620..cf2debd35 100755 --- a/cg/cg0200.cpp +++ b/cg/cg0200.cpp @@ -48,7 +48,7 @@ protected: //////////// static bool indsp_notify(TSheet_field& s, int r, KEY key); - static bool indsp_handler(TMask_field& f, KEY key) ; + static void indsp_sheet_rebuilder(); virtual int write(const TMask& m); virtual int rewrite(const TMask& m); virtual int read(TMask& m); @@ -522,35 +522,25 @@ void TClifo_application::common_f(const TMask& m) } } } - -bool TClifo_application::indsp_handler(TMask_field& f, KEY key) +void TClifo_application::indsp_sheet_rebuilder() { - static int first_time=1; - - if (key == K_TAB && f.dirty()) // Was it changed ? - if (first_time) - { - TArray& righe=app().indsp_sheet().rows_array(); - int n=righe.items(); - app().reset_sheet(); - // Rebuild Sheets - for (int i=0; iadd(rigav); - app().field_sheet(F_CODINDSP)->add(rigav); - app().field_sheet(F_CODINDEFF)->add(rigav); - } - first_time=0; - } else - first_time=1; - return TRUE; + TArray& righe=app().indsp_sheet().rows_array(); + const int n=righe.items(); + app().reset_sheet(); + // Rebuild Sheets + for (int i=0; iadd(rigav); + app().field_sheet(F_CODINDSP)->add(rigav); + app().field_sheet(F_CODINDEFF)->add(rigav); + } } bool TClifo_application::indsp_notify(TSheet_field& indsp, int r, KEY key) @@ -579,7 +569,9 @@ bool TClifo_application::indsp_notify(TSheet_field& indsp, int r, KEY key) break; default: break; -} +} + if (key == K_ENTER || key == K_DEL) + indsp_sheet_rebuilder(); return TRUE; } @@ -608,7 +600,6 @@ bool TClifo_application::user_create() // initvar e arrmask _msk->set_handler(F_CODALLEG, codalleg_handler); if (!_ignoreven) { - _msk->set_handler(F_SHEET_G_VEN, indsp_handler); TSheet_field& ind = (TSheet_field&) _msk->field(F_SHEET_G_VEN); ind.set_notify(indsp_notify); }