Corretta gestione uscita con Alt-F4

git-svn-id: svn://10.65.10.50/trunk@6530 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1998-04-17 09:39:54 +00:00
parent f02f2bf698
commit 6ddf9631ed

View File

@ -1,12 +1,12 @@
#include <time.h> #include <time.h>
#include <stdio.h> #include <stdio.h>
#include <applicat.h>
#include <controls.h> #include <controls.h>
#include <browfile.h> #include <browfile.h>
#include <colors.h> #include <colors.h>
#include <msksheet.h> #include <msksheet.h>
#include <os_dep.h> #include <os_dep.h>
#include <prefix.h>
#include <relation.h> #include <relation.h>
#include <urldefid.h> #include <urldefid.h>
#include <utility.h> #include <utility.h>
@ -335,10 +335,16 @@ void TMask::notify_focus_field(short id)
bool TMask::can_be_closed() const bool TMask::can_be_closed() const
{ {
bool ok = TRUE; if (is_running())
if (is_running() && (edit_mode() || insert_mode()) && dirty()) {
ok = yesno_box("Annullare i dati inseriti?"); bool ok = TRUE;
return ok; if ((edit_mode() || insert_mode()) && dirty())
ok = yesno_box("Annullare i dati inseriti?");
if (ok)
((TMask*)this)->stop_run(K_FORCE_CLOSE);
return FALSE;
}
return TRUE; // Should never happen!
} }
void TMask::close() void TMask::close()
@ -603,8 +609,13 @@ bool TMask::stop_run(
return FALSE; return FALSE;
} }
if (key == K_CTRL_ENTER || key == K_AUTO_ENTER) key = K_ENTER; else if (key == K_CTRL_ENTER || key == K_AUTO_ENTER)
if (key == K_FORCE_CLOSE) key = K_QUIT; key = K_ENTER;
else
{
if (key == K_FORCE_CLOSE)
key = (id2pos(DLG_QUIT)<0 && id2pos(DLG_CANCEL)>=0) ? K_ESC : K_QUIT;
}
if (key != K_ESC && key != K_QUIT && key != K_DEL && key != K_F9) if (key != K_ESC && key != K_QUIT && key != K_DEL && key != K_F9)
{ {
@ -1322,7 +1333,7 @@ void TMask::autosave(TRelation& r) const
void TMask::on_firm_change() void TMask::on_firm_change()
{ {
TString firm; firm << main_app().get_firm(); TString firm; firm << prefix().get_codditta();
for (int i = fields()-1; i >= 0; i--) for (int i = fields()-1; i >= 0; i--)
{ {
TMask_field& f = fld(i); TMask_field& f = fld(i);
@ -1843,7 +1854,7 @@ void TMask::set_exchange(
{ {
const real nuo = (n.sign() <= 0) ? _exchange : n; const real nuo = (n.sign() <= 0) ? _exchange : n;
main_app().begin_wait(); TWait_cursor hourglass;
for (int i = fields()-1; i >= 0; i--) for (int i = fields()-1; i >= 0; i--)
{ {
TMask_field& f = fld(i); TMask_field& f = fld(i);
@ -1854,9 +1865,7 @@ void TMask::set_exchange(
o.exchange(show_value, nuo); o.exchange(show_value, nuo);
} }
} }
_exchange = nuo; // Update current exchange _exchange = nuo; // Update current exchange
main_app().end_wait();
} }