diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 7618fd769..af68c1421 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -348,8 +348,8 @@ TSpreadsheet::TSpreadsheet( RCT rct = resize_rect(x, y, dx, dy, WO_TE, parent); #ifndef XI_FU_MULTIPLE - // rct.bottom -= 12 ; - // rct.right -= 28; + rct.bottom -= 12 ; + rct.right -= 28; #endif if ((f_width+max_width)*CHARX > rct.right) @@ -1777,6 +1777,17 @@ bool TSpreadsheet::notify(int rec, KEY k) return ok; } + +HIDDEN void enable_mask_fields(TMask& m, bool on) +{ + for (int i = m.fields()-1; i >= 0; i--) + { + TMask_field& f = m.fld(i); + if (f.dlg() >= FIRST_FIELD && f.enabled_default()) + f.enable(on); + } +} + // Certified 99% #if XVT_OS != XVT_OS_WIN KEY TSpreadsheet::edit(int n, KEY tasto) @@ -1819,35 +1830,47 @@ KEY TSpreadsheet::edit(int n, KEY tasto) } else - k = sheet_mask().run(); - - if (k == K_ENTER) { - mask2str(n); - } - else + if (!active()) // Se lo sheet e' read only ... + enable_mask_fields(sheet_mask(), FALSE); // ... disabilita tutti i campi + + k = sheet_mask().run(); // Esegue la maschera dello sheet + + if (!active()) // Se lo sheet e' read only ... + enable_mask_fields(sheet_mask(), TRUE); // ... riabilita tutti i campi + } + + if (active) { - if (k == K_DEL) + if (k == K_ENTER) { - const bool ok = notify(n, K_DEL); // Notifica intenzione di cancellare - if (ok) - { - destroy(n); - if (n < items()) - str2mask(n); - notify(n, K_CTRL+K_DEL); // Notifica l'avvenuta cancellazione - } + mask2str(n); } else - if (k == K_ESC) - { + { + if (k == K_DEL) + { + const bool ok = notify(n, K_DEL); // Notifica intenzione di cancellare + if (ok) + { + destroy(n); + if (n < items()) + str2mask(n); + notify(n, K_CTRL+K_DEL); // Notifica l'avvenuta cancellazione + } + } + else + if (k == K_ESC) + { #if XVT_OS == XVT_OS_WIN - str2mask(n); + str2mask(n); // Ripristina valori precedenti #else - if (tasto == K_INS) destroy(n); + if (tasto == K_INS) destroy(n); #endif - } - } + } + } + } + return k; }