Patch level :2.2 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :modificata e sveltita la scan cursor; e pure la progind


git-svn-id: svn://10.65.10.50/trunk@13837 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2006-03-08 16:57:18 +00:00
parent aa3dd28e95
commit bf12e004e5
2 changed files with 14 additions and 12 deletions

View File

@ -257,7 +257,7 @@ bool TProgind::setstatus(long l)
update(); update();
do_events(); do_events();
} }
return tictac; return !iscancelled();
} }
// TTimerind ------------------------------------------------------------ // TTimerind ------------------------------------------------------------

View File

@ -1677,36 +1677,38 @@ bool TCursor::is_first_match(int ln)
bool TCursor::scan(CURSOR_SCAN_FUNC func, void* pJolly, const char* msg) bool TCursor::scan(CURSOR_SCAN_FUNC func, void* pJolly, const char* msg)
{ {
TRecnotype tot = 0; // Temporarily TRecnotype tot = 0; // Temporarily
if (msg == NULL || *msg == '\0')
msg = TR("Elaborazione in corso...");
TProgind pi(tot, msg, true, true);
{ {
TWait_cursor hourglass; TWait_cursor hourglass;
tot = items(); tot = items();
} }
bool ok = true; bool ok = true;
if (tot > 0) if (tot > 0)
{ {
freeze(); TProgind* pi = NULL;
pi.setmax(tot); if (tot > 1)
{
if (msg == NULL || *msg == '\0')
msg = TR("Elaborazione in corso...");
pi = new TProgind(tot, msg, true, true);
}
freeze(true);
for (*this = 0; pos() < tot; ++*this) for (*this = 0; pos() < tot; ++*this)
{ {
pi.addstatus(1); if (!func(*relation(), pJolly))
if (pi.iscancelled())
{ {
ok = false; ok = false;
break; break;
} }
if (!func(*relation(), pJolly)) if (pi != NULL && !pi->addstatus(1))
{ {
ok = false; ok = false;
break; break;
} }
} }
freeze(false); freeze(false);
if (pi != NULL)
delete pi;
} }
return ok; return ok;
} }