diff --git a/include/form.cpp b/include/form.cpp index ad32c9465..fb58f2b05 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -1403,9 +1403,15 @@ bool TForm_list::update() int pos = _codes.get_pos(val); if (pos < 0) { - ok = yesno_box("Il campo '%s' non puo' valere '%s': continuare ugualmente", - (const char*)key(), (const char*)val); - set(_codes.get(pos = 0)); + TString def= _codes.get(0); + def.trim(); + if (val == def) pos = 0; // Test default (first & empty) value + else + { + ok = yesno_box("Il campo '%s' non puo' valere '%s': continuare ugualmente", + (const char*)key(), (const char*)val); + set(_codes.get(pos = 0)); + } } if (ok) { @@ -2080,6 +2086,7 @@ bool TForm::parse_general(TScanner &scanner) if (scanner.popkey() == "SI") // Font size _fontsize = scanner.integer(); else scanner.push(); + extended_parse_general(scanner); // Parse non-standard parameters } } else scanner.push(); @@ -2247,7 +2254,6 @@ bool TForm::print(long from, long to) TPrinter& pr = printer(); // Setta handlers pr.setheaderhandler(header_handler); pr.setfooterhandler(footer_handler); - pr.formlen(height()); pr.set_char_size(_fontsize); // Set font name and size pr.set_fontname(_fontname); // according to current form const bool was_open = pr.isopen(); @@ -2260,7 +2266,10 @@ bool TForm::print(long from, long to) return FALSE; do_events(); - if (to < 0) to = records()-1; + long lastrec= records()-1; + + if (to < 0) to = lastrec; + if (to == lastrec) to--; // l'ultima pagina è gestita come caso particolare bool ok = TRUE; @@ -2276,16 +2285,14 @@ bool TForm::print(long from, long to) set_body(page(pr), TRUE); } - if (i > records()) + if (i == lastrec) { - if (exist('H', last_page) || exist('B', last_page) || exist('F', last_page)) - { - _lastpage = TRUE; - set_background(0, TRUE); - set_header(0, TRUE); - set_body(0, TRUE); - pr.formfeed(); - } + if (_cursor) *_cursor = i; + _lastpage = TRUE; + set_background(0, TRUE); + set_header(0, TRUE); + set_body(0, TRUE); + pr.formfeed(); } if (!was_open) diff --git a/include/form.h b/include/form.h index b969ec57e..5714b6326 100755 --- a/include/form.h +++ b/include/form.h @@ -136,6 +136,7 @@ protected: bool parse_general(TScanner&); void print_general(ostream& out) const; + virtual void extended_parse_general(TScanner&) {} // Used to parse non-standard items in general section bool read_profile(); bool write_profile();