diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 7313bb518..635348547 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -1616,7 +1616,10 @@ void TList_sheet::do_output(CheckTime t) const bool hit = f.get() != val; f.set(val); if (field().dlg() != id && hit) + { f.on_hit(); + f.check(); + } } } } @@ -1736,6 +1739,7 @@ void TBrowse::parse_output(TScanner& scanner) _out_id.add(s); s = scanner.pop(); _out_fn.add(s); + _secondary = FALSE; } @@ -1795,7 +1799,7 @@ void TBrowse::parse_join(TScanner& scanner) key = scanner.integer(); else scanner.push(); - byte alias = 0; + int alias = 0; if (scanner.popkey() == "AL") alias = scanner.integer(); else scanner.push(); @@ -1815,7 +1819,7 @@ void TBrowse::parse_join(TScanner& scanner) #ifdef DBG if (exp.empty()) yesnofatal_box("JOIN senza espressioni INTO"); #endif - + if (isdigit(j[0])) _relation->add(atoi(j), exp, key, to, alias); // join file else @@ -1936,6 +1940,8 @@ int TBrowse::do_input( if (!filter) return ne; TString work(_filter.size()); + bool filter_update = FALSE; + for (int i = 0; _filter[i]; i++) { if (_filter[i] == '"') @@ -1955,10 +1961,15 @@ int TBrowse::do_input( while (isdigit(_filter[i])) i++; i--; } - else work << _filter[i]; + else + { + work << _filter[i]; + if (_filter[i] == '-' && _filter[i + 1] == '>') + filter_update = TRUE; + } } - _cursor->setfilter(work); + _cursor->setfilter(work, filter_update); _cursor->setregion(filtrec, filtrec); return ne; @@ -1996,22 +2007,35 @@ void TBrowse::do_output(CheckTime t) sum << fld.read(*_cursor->relation()); } } - + const bool hit = f.get() != sum; f.set(sum); if (field().dlg() != id && hit) + { f.on_hit(); + f.check(); + } } } } + void TBrowse::do_clear() { for (TString16 fld = _out_id.get(0); fld.not_empty(); fld = _out_id.get()) - { + { + const short id = field().atodlg(fld); TMask_field& f = field(atoi(fld)); if (f.field() == NULL && _inp_id.get_pos(fld) < 0) + { + const bool hit = f.get().not_empty(); f.reset(); + if (field().dlg() != id && hit) + { + f.on_hit(); + f.check(); + } + } } } @@ -2074,10 +2098,10 @@ bool TBrowse::do_link(bool insert) TString inp_id(i); TString16 field_name(_inp_fn.get()); TString s(field_name); - const int pos = s.find(","); + const int pos = s.find(","); - if (pos >= 0) - s.cut(pos); + if (pos >= 0) + s.cut(pos); s << "="; if (inp_id[0] == '"') @@ -2444,12 +2468,12 @@ bool TEdit_field::parse_item(TScanner& scanner) #endif int key = 1; - TRelation* r; + TRelation* r = NULL; const int logicnum = scanner.integer(); TString16 tabmaskname; - if (logicnum > 0) + if (logicnum > 0) r = new TRelation(logicnum); else { @@ -2480,15 +2504,15 @@ bool TEdit_field::parse_item(TScanner& scanner) filter = (const char*)scanner.line(); else scanner.push(); - + _browse = new TBrowse(this, r, key, filter); - + if (tabmaskname.not_empty()) { tabmaskname.insert("MBATB", 0); browse()->set_insert(tabmaskname); } - + _check_enabled = TRUE; return TRUE; } @@ -2521,7 +2545,7 @@ bool TEdit_field::parse_item(TScanner& scanner) return yesnofatal_box("JOIN senza USE nel campo %d", dlg()); else #endif - browse()->parse_join(scanner); + browse()->parse_join(scanner); return TRUE; } @@ -2792,11 +2816,17 @@ bool TEdit_field::on_key(KEY key) browse()->check(); } } - } + } if (ok) ok = on_hit(); - else - default_error_box(); + else + { + if (empty()) + ok = TRUE; + else + default_error_box(); + } + if (ok) { @@ -3179,11 +3209,11 @@ bool TReal_field::parse_item(TScanner& scanner) _decimals = _picture.len() - comma - 1; } } -#ifdef DBG - if (_ctl_data._size > 9 && _ctl_data._size != 15) - ::warning_box("Guy propone una dimensione di 15 per il campo %d: %s\nMa probabilmente ha toppato ...", - _ctl_data._dlg, (const char*)_ctl_data._prompt); -#endif +//#ifdef DBG +// if (_ctl_data._size > 9 && _ctl_data._size != 15) +// ::warning_box("Guy propone una dimensione di %d per il campo %d: %s\nMa probabilmente ha toppato ...", +// preferred_size, _ctl_data._dlg, (const char*)_ctl_data._prompt); +//#endif return TRUE; }