Corretti errori neele stampe w

git-svn-id: svn://10.65.10.50/trunk@64 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-08-26 13:07:24 +00:00
parent 86bd8244c4
commit b108a12dba
18 changed files with 1728 additions and 1697 deletions

View File

@ -293,7 +293,7 @@ HIDDEN bool sottoc_handler(TMask_field& f, KEY key)
TString conto(f.mask().get(FLD_CM1_CONTO)); TString conto(f.mask().get(FLD_CM1_CONTO));
TString sottoconto(f.mask().get(FLD_CM1_SOTTOCONTO)); TString sottoconto(f.mask().get(FLD_CM1_SOTTOCONTO));
if (sottoconto.not_empty() && conto.empty()) return f.error_box("Manca il CONTO"); if (sottoconto.not_empty() && conto.empty()) return f.error_box("Manca il CONTO");
dispatch_e_char(f.parent(), K_SHIFT_ENTER); dispatch_e_char(f.parent(), K_AUTO_ENTER);
} }
return TRUE; return TRUE;

View File

@ -50,7 +50,7 @@ HIDDEN bool key_handler (TMask_field& f, KEY k)
if (m.get(F_ANNO).not_empty() && m.get(F_CODATT).not_empty() && if (m.get(F_ANNO).not_empty() && m.get(F_CODATT).not_empty() &&
m.get(F_CODCF).not_empty()) m.get(F_CODCF).not_empty())
m.send_key(K_SHIFT_ENTER, 0); m.send_key(K_AUTO_ENTER, 0);
} }
return TRUE; return TRUE;
} }

View File

@ -396,12 +396,12 @@ void CG1600_application::set_bil_key(bil_ivd* b, char lettera, char sezione,
} }
} }
void CG1600_application::set_bil_val(bil_ivd* b, const real& saldo = ZERO, void CG1600_application::set_bil_val(bil_ivd* b, const real& saldo,
const real& saldorafr = ZERO, const real& saldorafr,
const real& sld_prg_dare = ZERO, const real& sld_prg_dare,
const real& sld_prg_avere = ZERO, const real& sld_prg_avere,
const real& mov_dare = ZERO, const real& mov_dare,
const real& mov_avere = ZERO) const real& mov_avere)
{ {
b->saldo = saldo; b->saldo = saldo;
b->saldorafr = saldorafr; b->saldorafr = saldorafr;

View File

@ -627,7 +627,7 @@ void TPrimanota_application::mask2rel(const TMask& m)
int TPrimanota_application::write(const TMask& m) int TPrimanota_application::write(const TMask& m)
{ {
const long numreg = m.get_long(F_NUMREG); const long numreg = m.get_long(F_NUMREG);
if (numreg > _lastreg) _lastreg = numreg; if (numreg > _lastreg) _lastreg = numreg; // Aggiorna ultima registrazione
mask2rel(m); mask2rel(m);
const int err = _rel->write(TRUE); const int err = _rel->write(TRUE);

View File

@ -1316,7 +1316,7 @@ void CG3200_application::calcola_progressivi()
pconti.put(PCN_CONTO , _conto); pconti.put(PCN_CONTO , _conto);
pconti.read(); pconti.read();
if (pconti.good()) if (pconti.good())
indbil = atoi (pconti.get(PCN_INDBIL)); indbil = pconti.get_int(PCN_INDBIL);
else else
indbil = 0; indbil = 0;
} }

View File

@ -3,9 +3,7 @@
#include <relation.h> #include <relation.h>
#include <tabutil.h> #include <tabutil.h>
#include <printapp.h> #include <printapp.h>
#include <date.h>
#include <mask.h> #include <mask.h>
#include <scanner.h>
#include <utility.h> #include <utility.h>
#include <prefix.h> #include <prefix.h>
#include <config.h> #include <config.h>
@ -13,14 +11,14 @@
#include <pconti.h> #include <pconti.h>
#include <comuni.h> #include <comuni.h>
#include <clifo.h> #include <clifo.h>
#include <saldi.h> #include <saldi.h>
#include <nditte.h> #include <nditte.h>
#include <anagr.h> #include <anagr.h>
#include <cglib.h> #include "cglib.h"
#include "cg3.h"
#include <cg3.h> #include "cg3500.h"
#include <cg3500.h>
typedef enum {stampagruppo, stampaconto, stampasottoconto, fine} tipo; typedef enum {stampagruppo, stampaconto, stampasottoconto, fine} tipo;

View File

@ -4,10 +4,7 @@
#include <tabutil.h> #include <tabutil.h>
#include <printapp.h> #include <printapp.h>
#include <mask.h> #include <mask.h>
#include <date.h>
#include <scanner.h>
#include <utility.h> #include <utility.h>
#include <prefix.h>
#include <config.h> #include <config.h>
#include <urldefid.h> #include <urldefid.h>
@ -18,7 +15,6 @@
#include <causali.h> #include <causali.h>
#include <nditte.h> #include <nditte.h>
#include "cg4.h"
#include "cg4500a.h" #include "cg4500a.h"
#include "cg4500b.h" #include "cg4500b.h"
@ -576,3 +572,15 @@ int cg4500 (int argc, char* argv[])
main_app.run(argc, argv, ""); main_app.run(argc, argv, "");
return TRUE; return TRUE;
} }
<<<<<<< cg4500.cpp
=======
>>>>>>> 1.4

View File

@ -546,6 +546,7 @@ TPush_button::TPush_button(short left, short top, short right, short bottom,
caption = format("#%d#%d", BMP_DELREC, BMP_DELRECDN); caption = format("#%d#%d", BMP_DELREC, BMP_DELRECDN);
break; break;
case DLG_NEWREC: case DLG_NEWREC:
if (height > ROWY && strcmp("~Nuovo", caption) == 0) // Puo' essere Gestione
caption = format("#%d#%d", BMP_NEWREC, BMP_NEWRECDN); caption = format("#%d#%d", BMP_NEWREC, BMP_NEWRECDN);
break; break;
case DLG_FIRSTREC: case DLG_FIRSTREC:

View File

@ -16,6 +16,7 @@
#define K_CTRL_ENTER K_CTRL+K_ENTER #define K_CTRL_ENTER K_CTRL+K_ENTER
#define K_AUTO_ENTER K_SHIFT+K_ENTER #define K_AUTO_ENTER K_SHIFT+K_ENTER
#define K_QUIT 10334 #define K_QUIT 10334
#define K_FORCE_CLOSE 11334
#define K_SAVE 10082 #define K_SAVE 10082
#define K_SHIFT_TAB K_SHIFT+K_TAB #define K_SHIFT_TAB K_SHIFT+K_TAB
#define K_SHIFT_F2 K_SHIFT+K_F2 #define K_SHIFT_F2 K_SHIFT+K_F2

View File

@ -98,10 +98,12 @@ void TMask::handler(WINDOW win, EVENT* ep)
switch(ep->v.ctl.id) switch(ep->v.ctl.id)
{ {
case DLG_OK : case DLG_OK :
on_key(K_AUTO_ENTER); break; stop_run(K_AUTO_ENTER); break;
case DLG_BAR : case DLG_BAR :
case DLG_CANCEL : case DLG_CANCEL :
on_key(K_ESC); break; stop_run(K_ESC); break;
case DLG_QUIT :
stop_run(K_FORCE_CLOSE); break;
/* /*
case DLG_PGDN : case DLG_PGDN :
on_key(K_NEXT); break; on_key(K_NEXT); break;
@ -123,8 +125,6 @@ void TMask::handler(WINDOW win, EVENT* ep)
stop_run(K_DEL); break; stop_run(K_DEL); break;
case DLG_SAVEREC : case DLG_SAVEREC :
stop_run(K_SAVE); break; stop_run(K_SAVE); break;
case DLG_QUIT :
stop_run(K_QUIT); break;
*/ */
case DLG_F9: case DLG_F9:
{ {
@ -557,18 +557,18 @@ int TMask::find_active_field(int first, int dir) const
void TMask::set_focus() void TMask::set_focus()
{ {
_focus = find_active_field(_focus, +1); _focus = find_active_field(_focus, +1);
const int page = find_parent_page(fld(_focus)); const TMask_field& f = fld(_focus);
const int page = find_parent_page(f);
if (page != _page && page != MAX_PAGES) if (page != _page && page != MAX_PAGES)
{ {
const WINDOW pw = win(); // previous window const WINDOW pw = win(); // previous window
_page = page; _page = page; // update page number
show_window(win(), TRUE); // show new page show_window(win(), TRUE); // show new page
if (pw) show_window(pw, FALSE); // hide old page if (pw) show_window(pw, FALSE); // hide old page
} }
const WINDOW fw = fld(_focus).win(); set_front_window(f.win());
set_front_window(fw);
} }
@ -577,9 +577,9 @@ void TMask::move_focus_field(int d)
{ {
TMask_field& f = fld(_focus); TMask_field& f = fld(_focus);
if (f.on_key(K_TAB) == FALSE) // New style if (f.on_key(K_TAB) == FALSE) // Don't you agree to lose focus? ...
{ {
set_focus(); set_focus(); // ... Keep it
return; return;
} }
@ -601,9 +601,7 @@ void TMask::move_focus_field(int d)
bool TMask::stop_run(KEY key) bool TMask::stop_run(KEY key)
{ {
if (key == K_CTRL_ENTER) key = K_ENTER; if (key != K_AUTO_ENTER && key != K_FORCE_CLOSE)
if (key != K_AUTO_ENTER)
{ {
const int last = fields(); const int last = fields();
bool found = FALSE; bool found = FALSE;
@ -626,11 +624,13 @@ bool TMask::stop_run(KEY key)
#ifdef DBG #ifdef DBG
return error_box("Non e' attivo il bottone associato a %d", key); return error_box("Non e' attivo il bottone associato a %d", key);
#else #else
beep();
return FALSE; return FALSE;
#endif #endif
} }
} else key = K_ENTER; }
if (key == K_CTRL_ENTER) key = K_ENTER; else
if (key == K_FORCE_CLOSE) key = K_QUIT;
if (key != K_ESC && key != K_QUIT && key != K_DEL) if (key != K_ESC && key != K_QUIT && key != K_DEL)
{ {
@ -694,7 +694,7 @@ bool TMask::on_key(KEY key)
if (key > K_CTRL) if (key > K_CTRL)
{ {
key -= K_CTRL; key -= K_CTRL;
if (key >= K_F1 && key <= K_F10) if (key >= K_F1 && key <= K_F12)
next_page(1000 + key - K_F1); next_page(1000 + key - K_F1);
else else
{ {

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.3 1994-08-23 13:52:21 guy Exp $ // $Id: maskfld.cpp,v 1.4 1994-08-26 13:07:14 guy Exp $
#include <xvt.h> #include <xvt.h>
#include <applicat.h> #include <applicat.h>
@ -1721,13 +1721,13 @@ const char* TEdit_field::format(const char* d)
if (fpark.not_empty()) if (fpark.not_empty())
{ {
#ifdef DBG
if (fpark.len() > _size) if (fpark.len() > _size)
{ {
#ifdef DBG
error_box("Campo %d troppo lungo: %d > %d", dlg(), fpark.len(), _size); error_box("Campo %d troppo lungo: %d > %d", dlg(), fpark.len(), _size);
#endif
fpark.cut(_size); fpark.cut(_size);
} }
#endif
if (_flags.uppercase) if (_flags.uppercase)
fpark.upper(); fpark.upper();

View File

@ -32,6 +32,11 @@ class TSpreadsheet : public TWindow
SPREADSHEET_NOTIFY _notify; SPREADSHEET_NOTIFY _notify;
TMask_field* _edit_field; // Current edit field
int _cur_row, _cur_col; // Current cell
bool _row_dirty; // Current row changed
bool _check_enabled; // Perform OFF_ROW checks
static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev); static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
void init(); void init();
@ -99,11 +104,12 @@ void TSpreadsheet::init()
first = FALSE; first = FALSE;
} }
TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy, TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
const char* maskname, int maskno, const char* maskname, int maskno,
const char* head, WINDOW parent) const char* head, WINDOW parent)
: _mask(maskname, NO_MODE, maskno), _notify(NULL) : _mask(maskname, NO_MODE, maskno), _notify(NULL), _edit_field(NULL), _cur_row(0), _cur_col(0),
_row_dirty(FALSE), _check_enabled(TRUE)
{ {
const int NUMBER_WIDTH = 3; const int NUMBER_WIDTH = 3;
const int MAX_COL = 32; const int MAX_COL = 32;
@ -259,8 +265,8 @@ TMask_field* TSpreadsheet::cell2field(const XI_OBJ* cell) const
{ {
TMask_field* f = field(id); TMask_field* f = field(id);
if (f == NULL) break; if (f == NULL) break;
good = f; good = f; // We've found a field with the proper ID ...
if (f->active()) break; if (f->active()) break; // ... and it's active: end of search
} }
return good; return good;
@ -280,7 +286,7 @@ void TSpreadsheet::update_rec(int rec)
void TSpreadsheet::set_focus_cell(int riga, int colonna) void TSpreadsheet::set_focus_cell(int riga, int colonna)
{ {
set_front_window(win()); // set_front_window(win());
XI_OBJ cell; XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, rec2row(riga), colonna); XI_MAKE_CELL(&cell, _list, rec2row(riga), colonna);
xi_set_focus(&cell); xi_set_focus(&cell);
@ -331,7 +337,9 @@ void TSpreadsheet::update(int row)
{ {
xi_cell_request(_list); xi_cell_request(_list);
xi_scroll(_list, XI_SCROLL_FIRST); xi_scroll(_list, XI_SCROLL_FIRST);
set_front_window(win()); XI_OBJ* itf = xi_get_itf(win());
xi_set_focus(itf);
// set_front_window(win());
} }
else else
update_rec(row); update_rec(row);
@ -349,11 +357,6 @@ void TSpreadsheet::xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
// Certified 75% // Certified 75%
void TSpreadsheet::list_handler(XI_EVENT *xiev) void TSpreadsheet::list_handler(XI_EVENT *xiev)
{ {
static TMask_field* edit_field = NULL; // Current edit field
static int cur_row = 0, cur_col = 0; // Current cell
static bool row_dirty = FALSE; // Current row changed
static bool check_enabled = TRUE; // Perform OFF_ROW checks
switch (xiev->type) switch (xiev->type)
{ {
case XIE_GET_FIRST: case XIE_GET_FIRST:
@ -430,18 +433,18 @@ break;
case XIE_BUTTON: case XIE_BUTTON:
if (xiev->v.xi_obj->type == XIT_CELL) if (xiev->v.xi_obj->type == XIT_CELL)
{ {
if (edit_field) if (_edit_field)
{ {
const char* val = xi_get_text(xiev->v.xi_obj, NULL, -1); const char* val = xi_get_text(xiev->v.xi_obj, NULL, -1);
edit_field->set(val); // Update current cell _edit_field->set(val); // Update current cell
check_enabled = FALSE; // Disable checks _check_enabled = FALSE; // Disable checks
if (!row_dirty) notify(cur_row, K_SPACE); if (!_row_dirty) notify(_cur_row, K_SPACE);
if (edit_field->on_key(K_F9)) // Show search sheet if (_edit_field->on_key(K_F9)) // Show search sheet
{ {
mask2str(cur_row); // Update row mask2str(_cur_row); // Update row
row_dirty = TRUE; _row_dirty = TRUE;
} }
check_enabled = TRUE; // Enable checks _check_enabled = TRUE; // Enable checks
xi_set_focus(xiev->v.xi_obj); // Restore focus to cell xi_set_focus(xiev->v.xi_obj); // Restore focus to cell
} }
} else } else
@ -450,17 +453,17 @@ if (xiev->v.xi_obj->type == XIT_LIST)
break; break;
case XIE_DBL_CELL: case XIE_DBL_CELL:
{ {
check_enabled = FALSE; _check_enabled = FALSE;
cur_row = row2rec(xiev->v.xi_obj->v.cell.row); _cur_row = row2rec(xiev->v.xi_obj->v.cell.row);
cur_col = xiev->v.xi_obj->v.cell.column; _cur_col = xiev->v.xi_obj->v.cell.column;
const KEY k = edit(cur_row); const KEY k = edit(_cur_row);
if (k == K_ENTER) if (k == K_ENTER)
{ {
update_rec(cur_row); update_rec(_cur_row);
row_dirty = TRUE; _row_dirty = TRUE;
} }
xi_set_focus(xiev->v.xi_obj); xi_set_focus(xiev->v.xi_obj);
check_enabled = TRUE; _check_enabled = TRUE;
} }
break; break;
case XIE_ON_ROW: case XIE_ON_ROW:
@ -468,24 +471,24 @@ break;
const int rec = row2rec(xiev->v.xi_obj->v.row); const int rec = row2rec(xiev->v.xi_obj->v.row);
if (rec < items()) if (rec < items())
{ {
cur_row = rec; _cur_row = rec;
str2mask(rec); str2mask(rec);
row_dirty = FALSE; _row_dirty = FALSE;
} }
else else
xiev->refused = TRUE; xiev->refused = TRUE;
} }
break; break;
case XIE_OFF_ROW: case XIE_OFF_ROW:
if (row_dirty && check_enabled) if (_row_dirty && _check_enabled)
{ {
check_enabled = FALSE; // Avoid recursion! _check_enabled = FALSE; // Avoid recursion!
str2mask(cur_row); // It shouldn't have to be necessary str2mask(_cur_row); // It shouldn't have to be necessary
bool ok = _mask.check_fields(); bool ok = _mask.check_fields();
if (ok) if (ok)
{ {
mask2str(cur_row); mask2str(_cur_row);
ok = notify(cur_row, K_ENTER); // Notify edit ok = notify(_cur_row, K_ENTER); // Notify edit
} }
if (!ok) if (!ok)
{ {
@ -497,17 +500,17 @@ break;
xvt_statbar_set(""); xvt_statbar_set("");
set_dirty(); set_dirty();
} }
check_enabled = TRUE; _check_enabled = TRUE;
} }
break; break;
case XIE_ON_CELL: case XIE_ON_CELL:
{ {
TMask_field* f = cell2field(xiev->v.xi_obj); TMask_field* f = cell2field(xiev->v.xi_obj);
const int col = (f->dlg() - FIRST_FIELD) % 100; const int col = (f->dlg() - FIRST_FIELD) % 100;
if (!cell_disabled(cur_row, col)) if (!cell_disabled(_cur_row, col))
{ {
edit_field = f; _edit_field = f;
cur_col = xiev->v.xi_obj->v.cell.column; _cur_col = xiev->v.xi_obj->v.cell.column;
xi_set_color(xiev->v.xi_obj, XIC_BACK, FOCUS_BACK_COLOR); xi_set_color(xiev->v.xi_obj, XIC_BACK, FOCUS_BACK_COLOR);
} }
else else
@ -528,18 +531,18 @@ break;
} }
break; break;
case XIE_OFF_CELL: case XIE_OFF_CELL:
if (edit_field && check_enabled) if (_edit_field && _check_enabled)
{ {
TMask_field* c = edit_field; // Save field, it could turn out to be NULL on error TMask_field* c = _edit_field; // Save field, it could turn out to be NULL on error
const TString80 old(c->get()); // Save old value on mask const TString80 old(c->get()); // Save old value on mask
const TString80 nuo(c->picture_data(xi_get_text(xiev->v.xi_obj, NULL, -1), TRUE)); const TString80 nuo(c->picture_data(xi_get_text(xiev->v.xi_obj, NULL, -1), TRUE));
if (old != nuo) if (old != nuo)
{ {
check_enabled = FALSE; _check_enabled = FALSE;
if (!row_dirty) if (!_row_dirty)
{ {
notify(cur_row, K_SPACE); notify(_cur_row, K_SPACE);
row_dirty = TRUE; _row_dirty = TRUE;
} }
c->set(nuo); // Set new mask value c->set(nuo); // Set new mask value
c->set_dirty(); // Get it dirty! c->set_dirty(); // Get it dirty!
@ -550,10 +553,10 @@ break;
} }
else else
{ {
mask2str(cur_row); // Update sheet row mask2str(_cur_row); // Update sheet row
edit_field = NULL; // Reset current field _edit_field = NULL; // Reset current field
} }
check_enabled = TRUE; _check_enabled = TRUE;
} }
if (!xiev->refused) if (!xiev->refused)
xi_set_color(xiev->v.xi_obj, XIC_BACK, NORMAL_BACK_COLOR); xi_set_color(xiev->v.xi_obj, XIC_BACK, NORMAL_BACK_COLOR);
@ -580,35 +583,38 @@ break;
XI_OBJ* itf = xi_get_itf(win()); XI_OBJ* itf = xi_get_itf(win());
const bool ok = (bool)xi_move_focus(itf); const bool ok = (bool)xi_move_focus(itf);
if (!ok) if (!ok)
{
set_dirty(2);
xiev->refused = TRUE; xiev->refused = TRUE;
} }
}
break; break;
case E_CHAR: case E_CHAR:
if (edit_field) if (_edit_field)
{ {
const KEY k = e_char_to_key(ep); const KEY k = e_char_to_key(ep);
switch(k) switch(k)
{ {
case K_F1: case K_F1:
check_enabled = FALSE; // Disable checks _check_enabled = FALSE; // Disable checks
edit_field->on_key(K_F1); _edit_field->on_key(K_F1);
set_focus_cell(cur_row, cur_col); set_focus_cell(_cur_row, _cur_col);
check_enabled = TRUE; // Enable checks _check_enabled = TRUE; // Enable checks
break; break;
case K_F2: case K_F2:
case K_F3: case K_F3:
case K_F8: case K_F8:
case K_F9: case K_F9:
{ {
check_enabled = FALSE; // Disable checks _check_enabled = FALSE; // Disable checks
if (!row_dirty) notify(cur_row, K_SPACE); if (!_row_dirty) notify(_cur_row, K_SPACE);
if (edit_field->on_key(k)) if (_edit_field->on_key(k))
{ {
mask2str(cur_row); mask2str(_cur_row);
row_dirty = TRUE; _row_dirty = TRUE;
} }
set_focus_cell(cur_row, cur_col); set_focus_cell(_cur_row, _cur_col);
check_enabled = TRUE; // Enable checks _check_enabled = TRUE; // Enable checks
} }
break; break;
case K_PREV: case K_PREV:

View File

@ -1 +1 @@
#define VERSION 1.8 #define VERSION 1.9

View File

@ -76,13 +76,12 @@ TSheet::TSheet(short x, short y, short dx, short dy,
void TSheet::add_button(short id, const char* caption, KEY key) void TSheet::add_button(short id, const char* caption, KEY key)
{ {
const int BUT_HEIGHT =
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
2 const int BUT_HEIGHT = 2;
#else #else
1 const int BUT_HEIGHT = 1;
#endif #endif
;
WINDOW b = xvt_create_control(WC_PUSHBUTTON, 0, 0, 11, BUT_HEIGHT, caption, win(), 0, 0, id); WINDOW b = xvt_create_control(WC_PUSHBUTTON, 0, 0, 11, BUT_HEIGHT, caption, win(), 0, 0, id);
for (int i = 0; i < MAX_BUT; i++) for (int i = 0; i < MAX_BUT; i++)
if (_button[i] == NULL_WIN) if (_button[i] == NULL_WIN)
@ -611,21 +610,25 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
{ {
xvt_create_control(WC_EDIT, 1, -3, f->size()+1, 1, f->get(), win(), xvt_create_control(WC_EDIT, 1, -3, f->size()+1, 1, f->get(), win(),
CTL_FLAG_DISABLED, 0L, 100); CTL_FLAG_DISABLED, 0L, 100);
if (s)
{
WINDOW listbox = xvt_create_control(WC_LISTBUTTON, f->size()+3, -3, 18, 3,
"", win(), 0, 0L, 99);
if (s && s->items() > 2)
{
int maxlen = 0;
SLIST lst = slist_new(); SLIST lst = slist_new();
for (const char* item = s->get(0); item; item = s->get()) for (const char* item = s->get(0); item; item = s->get())
{ {
item = s->get(); item = s->get();
const int len = strlen(item);
if (len > maxlen) maxlen = len;
slist_add(lst, (SLIST_ELT)NULL, (char*)item, 0L); slist_add(lst, (SLIST_ELT)NULL, (char*)item, 0L);
} }
WINDOW listbox = xvt_create_control(WC_LISTBUTTON, f->size()+3, -3, maxlen+3, 3,
"", win(), 0, 0L, 99);
win_list_add(listbox, -1, (char*)lst); win_list_add(listbox, -1, (char*)lst);
slist_dispose(lst); slist_dispose(lst);
TString id(3); id << f->dlg(); TString16 id; id << f->dlg();
const int sel = s->get_pos(id) >> 1; const int sel = s->get_pos(id) >> 1;
win_list_set_sel(listbox, sel, TRUE); win_list_set_sel(listbox, sel, TRUE);
} }
@ -649,7 +652,7 @@ void TBrowse_sheet::repos_buttons() const
if (w != NULL_WIN) if (w != NULL_WIN)
{ {
RCT r; get_client_rect(w, &r); RCT r; get_client_rect(w, &r);
r.left = CHARX*(id == 99 ? 1 : 21); r.left = CHARX*(id == 99 ? _field->size()+3 : 1);
r.top = wr.bottom - 4*CHARY + 4; r.top = wr.bottom - 4*CHARY + 4;
r.right += r.left; r.right += r.left;
r.bottom += r.top; r.bottom += r.top;
@ -673,7 +676,12 @@ bool TBrowse_sheet::on_key(KEY k)
const TString old(_field->get()); const TString old(_field->get());
TString val(old.size()+1); val = old; TString val(old.size()+1); val = old;
if (alnum) val << char(k); if (alnum)
{
if (val.len() > field().size())
val.cut(0);
val << char(k);
}
else val.rtrim(1); else val.rtrim(1);
field().set(val); field().set(val);

View File

@ -18,7 +18,7 @@ END
BUTTON DLG_FINDREC 8 2 BUTTON DLG_FINDREC 8 2
BEGIN BEGIN
PROMPT -46 -1 "Ricerca" PROMPT -46 -1 "Ri~cerca"
MESSAGE EXIT,K_F9 MESSAGE EXIT,K_F9
END END

View File

@ -28,7 +28,7 @@ HIDDEN bool _expr_val(TEdit_field& f, KEY)
const char* s = e.varname(i); const char* s = e.varname(i);
if (s[0] != '#') if (s[0] != '#')
{ {
TString err(64); err << "Cannot load variable " << s << " in " << e; TString80 err; err << "Cannot load variable " << s << " in " << e;
return f.error_box((const char*)err); return f.error_box((const char*)err);
} }
s++; s++;
@ -100,7 +100,7 @@ bool pi_check(const char * st, const char * paiva)
// Controlla la partita iva se e' non vuota ed italiana // Controlla la partita iva se e' non vuota ed italiana
HIDDEN bool _pi_val(TEdit_field& f, KEY) HIDDEN bool _pi_val(TEdit_field& f, KEY)
{ {
TString stato(f.mask().get(atoi(get_val_param(0)))), pi(f.get()); TString16 stato(f.mask().get(atoi(get_val_param(0)))), pi(f.get());
if (stato.not_empty() && stato != "IT") return TRUE; if (stato.not_empty() && stato != "IT") return TRUE;
if (pi.empty()) return TRUE; if (pi.empty()) return TRUE;
@ -220,10 +220,10 @@ HIDDEN bool _xt_pi_val(TEdit_field& f, KEY key)
TMask& m = f.mask(); TMask& m = f.mask();
if (m.query_mode()) return TRUE; if (m.query_mode()) return TRUE;
TString value(f.get()); TString16 value(f.get());
if (value.empty()) return f.error_box("Partita IVA obbligatoria"); if (value.empty()) return f.error_box("Partita IVA obbligatoria");
const TString stato(m.get(atoi(get_val_param(0)))); const TString16 stato(m.get(atoi(get_val_param(0))));
if (stato.not_empty() && stato != "IT") return TRUE; if (stato.not_empty() && stato != "IT") return TRUE;
if (!_pi_val(f, key)) return FALSE; if (!_pi_val(f, key)) return FALSE;
@ -237,7 +237,7 @@ HIDDEN bool _xt_pi_val(TEdit_field& f, KEY key)
const int comune = atoi(get_val_param(i)); const int comune = atoi(get_val_param(i));
if (comune) if (comune)
{ {
const TString com(m.get(comune)); // Comune residenza fiscale e residenza const TString16 com(m.get(comune)); // Comune residenza fiscale e residenza
if (com.not_empty()) if (com.not_empty())
{ {
c.zero(); c.zero();
@ -269,7 +269,7 @@ HIDDEN bool _xtz_pi_val(TEdit_field& f, KEY key)
{ {
if (f.mask().query_mode()) return TRUE; if (f.mask().query_mode()) return TRUE;
TString pi(f.get()); TString16 pi(f.get());
if (pi.empty()) return TRUE; if (pi.empty()) return TRUE;
return _xt_pi_val(f, key); return _xt_pi_val(f, key);
} }
@ -280,7 +280,7 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
{ {
if (f.mask().query_mode()) return TRUE; if (f.mask().query_mode()) return TRUE;
const TString cf(f.get()); const TString16 cf(f.get());
if (cf.empty()) return f.error_box("Codice fiscale obbligatorio"); if (cf.empty()) return f.error_box("Codice fiscale obbligatorio");
if (!_cf_val(f, key)) return FALSE; if (!_cf_val(f, key)) return FALSE;
@ -288,7 +288,7 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
if (cf.len() == 11) if (cf.len() == 11)
{ {
if (!_xt_pi_val(f, key)) return FALSE; if (!_xt_pi_val(f, key)) return FALSE;
TString stato(f.mask().get(atoi(get_val_param(0)))); TString16 stato(f.mask().get(atoi(get_val_param(0))));
if ((stato.not_empty()) && (stato != "IT")) return TRUE; if ((stato.not_empty()) && (stato != "IT")) return TRUE;
} }
@ -302,10 +302,10 @@ HIDDEN bool _xt_cf_val(TEdit_field& f, KEY key)
TMask_field& fld_com = m.field(atoi(get_val_param(3))); TMask_field& fld_com = m.field(atoi(get_val_param(3)));
char sesso = fld_sex.get()[0]; char sesso = fld_sex.get()[0];
TString data(fld_dat.get()); TString16 data(fld_dat.get());
TString com(fld_com.get()); TString16 com(fld_com.get());
TString wm("LMNPQRSTUV"); TString16 wm("LMNPQRSTUV");
int p; int p;
if ((p = wm.find(cf[6])) != -1) cf[6] = '0' + p; if ((p = wm.find(cf[6])) != -1) cf[6] = '0' + p;
if ((p = wm.find(cf[7])) != -1) cf[7] = '0' + p; if ((p = wm.find(cf[7])) != -1) cf[7] = '0' + p;
@ -494,7 +494,7 @@ HIDDEN bool _numcalc_val(TEdit_field& f, KEY k)
const char* s = e.varname(i); const char* s = e.varname(i);
if (s[0] != '#') if (s[0] != '#')
{ {
TString err(64); err << "Cannot load variable " << s << " in " << e; TString80 err; err << "Cannot load variable " << s << " in " << e;
return f.error_box((const char*)err); return f.error_box((const char*)err);
} }
s++; s++;
@ -517,7 +517,7 @@ HIDDEN bool _strcalc_val(TEdit_field& f, KEY k)
const char* s = e.varname(i); const char* s = e.varname(i);
if (s[0] != '#') if (s[0] != '#')
{ {
TString err(64); err << "Cannot load variable " << s << " in " << e; TString80 err; err << "Cannot load variable " << s << " in " << e;
return f.error_box((const char*)err); return f.error_box((const char*)err);
} }
s++; s++;

View File

@ -53,7 +53,7 @@ void TWindow_manager::destroy()
while (_current >= 0) while (_current >= 0)
{ {
TWindow* w = cur_win(); TWindow* w = cur_win();
w->stop_run(K_QUIT); w->stop_run(K_FORCE_CLOSE);
w->close_modal(); w->close_modal();
} }
} }

View File

@ -750,8 +750,17 @@ void xvt_statbar_refresh()
HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag) HIDDEN bool test_menu_tag(MENU_ITEM* mi, MENU_TAG tag)
{ {
CHECK(mi, "Can't test NULL MENU_ITEM"); CHECK(mi, "Can't test NULL MENU_ITEM");
while (mi->tag)
{
if (mi->tag == tag) return TRUE; if (mi->tag == tag) return TRUE;
if (mi->child != NULL) return test_menu_tag(mi->child, tag); if (mi->child != NULL)
{
const bool ok = test_menu_tag(mi->child, tag);
if (ok) return TRUE;
}
mi++;
}
return FALSE; return FALSE;
} }