Flag per l'abilitazione dell'insert/append righe da maschera ("I")
git-svn-id: svn://10.65.10.50/trunk@4601 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
545dbe95bf
commit
f403648d42
@ -2133,7 +2133,9 @@ bool TSheet_field::parse_item(TScanner& scanner)
|
||||
|
||||
if (scanner.key() == "FL") // FLAGS
|
||||
{
|
||||
_enable_autoload=scanner.string()=="A";
|
||||
TString16 flags(scanner.string());
|
||||
_enable_autoload=(flags.find("A")>=0);
|
||||
_append=(flags.find("I")<0);
|
||||
return TRUE;
|
||||
}
|
||||
if (scanner.key() == "US") // USE
|
||||
@ -2163,7 +2165,7 @@ bool TSheet_field::parse_item(TScanner& scanner)
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -2701,34 +2703,56 @@ TRectype * TSheet_field::putkey(const TRelation& r)
|
||||
// Certified: ...under debug..
|
||||
bool TSheet_field::autoload_line(int i,TRectype & rec)
|
||||
{
|
||||
TToken_string &row= this->row(i-1);
|
||||
|
||||
row = "";
|
||||
// riempie le colonne dello sheet i cui campi hanno attributo "FIELD"
|
||||
for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
|
||||
TFieldref const *dbfield=sheet_mask().field(f).field();
|
||||
if (dbfield) {
|
||||
row.add(dbfield->read(rec),cid2index(f));
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
}
|
||||
if (_userget)
|
||||
_userget(*this,i);
|
||||
check_row(i-1);
|
||||
TToken_string &row= this->row(i-1);
|
||||
|
||||
row = "";
|
||||
// riempie le colonne dello sheet i cui campi hanno attributo "FIELD"
|
||||
/*for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
|
||||
TFieldref const *dbfield=sheet_mask().field(f).field();
|
||||
if (dbfield) {
|
||||
row.add(dbfield->read(rec),cid2index(f));
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
} */
|
||||
for (int j = 0; j < sheet_mask().fields(); j++)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield) {
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id) {
|
||||
row.add(dbfield->read(rec),cid2index(id));
|
||||
} else {
|
||||
mf.set(dbfield->read(rec));
|
||||
}
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userget)
|
||||
_userget(*this,i);
|
||||
check_row(i-1);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
// Certified: ...under debug..
|
||||
bool TSheet_field::autosave_line(int i,TRectype & rec)
|
||||
{
|
||||
for (int f=FIRST_FIELD; f<=_last_column_id; f++) {
|
||||
TFieldref const *dbfield=sheet_mask().field(f).field();
|
||||
if (dbfield)
|
||||
dbfield->write(cell(i-1,cid2index(f)),rec);
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userput)
|
||||
_userput(*this,i);
|
||||
for (int j = 0; j < sheet_mask().fields(); j++)
|
||||
{
|
||||
TMask_field& mf = sheet_mask().fld(j);
|
||||
const short id = mf.dlg();
|
||||
TFieldref const *dbfield=mf.field();
|
||||
if (dbfield)
|
||||
{
|
||||
if (id>=FIRST_FIELD && id<=_last_column_id)
|
||||
dbfield->write(cell(i-1,cid2index(id)),rec);
|
||||
else
|
||||
dbfield->write(mf.get(), rec);
|
||||
}
|
||||
}
|
||||
// completa l'operazione con le funzioni definite dall'utente
|
||||
if (_userput)
|
||||
_userput(*this,i);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -2774,10 +2798,14 @@ bool TSheet_field::autosave(TRelation& rel)
|
||||
}
|
||||
}
|
||||
// *******
|
||||
// trasferisce le linee dallo sheet al record array
|
||||
for (int i= 1; i <= items(); i++)
|
||||
// trasferisce le linee dallo sheet al record array (ignorando righe vuote alla fine)
|
||||
int i= items();
|
||||
while (i >= 1 && row(i-1).empty_items())
|
||||
i--;
|
||||
for (; i >= 1; i--)
|
||||
{
|
||||
autosave_line(i,_linee_rec->row(i, TRUE));
|
||||
TRectype &rec = _linee_rec->row(i, TRUE);
|
||||
autosave_line(i,rec);
|
||||
}
|
||||
}
|
||||
return _enable_autoload;
|
||||
|
Loading…
x
Reference in New Issue
Block a user