Patch level : 2.0 nopatch

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :

Trasformato metodo TMask::set(short id , const char* val, bool hit = FALSE)
nel nuovo          TMask::set(short id , const char* val, byte hit = 0)
cui si puo' passare 0, 1, 2 o 3: il bit = hit, bit 2 = check


git-svn-id: svn://10.65.10.50/trunk@11111 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2003-05-09 14:09:16 +00:00
parent c1db46b2c9
commit 490bab53d1
4 changed files with 31 additions and 27 deletions

View File

@ -33,28 +33,30 @@ public:
void TInfo_mask::add_row(const char* prompt, const char* value) void TInfo_mask::add_row(const char* prompt, const char* value)
{ {
const int MASK_WIDTH = 76; const int MASK_WIDTH = 78;
const int MASK_WIDTH2 = MASK_WIDTH/2;
const int PROMPT_WIDTH = 12; const int PROMPT_WIDTH = 12;
TString val(value); TString val(value); val.trim();
const int len = val.len(); const int len = val.len();
if (_col + PROMPT_WIDTH + len > MASK_WIDTH) const int estim_len = 120 * (PROMPT_WIDTH + len) / 100;
if (_col + estim_len > MASK_WIDTH)
{ {
_row++; _row++;
_col = 1; _col = 1;
} }
TString pr(prompt); TString16 pr(prompt);
if (pr.not_empty())
pr.left_just(PROMPT_WIDTH); pr.left_just(PROMPT_WIDTH);
const short id = 101 + _row*10 + (_col > 1); const short id = 101 + _row*10 + (_col > 1);
TEdit_field& e = add_string(id, 0, pr, _col, _row, len, "", len > 50 ? 50 : len); TEdit_field& e = add_string(id, 0, pr, _col, _row, len, "", len > 50 ? 50 : len);
e.set(value); e.set(value);
if (pr.len()+len > MASK_WIDTH/2)
_col += MASK_WIDTH; if (_col == 1)
_col = (estim_len+2 >= MASK_WIDTH2) ? MASK_WIDTH : MASK_WIDTH2;
else else
_col += MASK_WIDTH/2; _col = MASK_WIDTH;
} }
void TInfo_mask::add_row(const char* prompt, unsigned long value) void TInfo_mask::add_row(const char* prompt, unsigned long value)

View File

@ -637,12 +637,11 @@ int DB_packfile(short vis, const char * filename, long eod)
handle=DB_open(filename,1,0); /* Exclusive mode open! */ handle=DB_open(filename,1,0); /* Exclusive mode open! */
if (handle > -1) if (handle > -1)
{ {
char s[81];
if (vis) if (vis)
{ {
strcpy(s,"Compattamento dati file : "); char s[_MAX_PATH];
strcat(s,(char*)filename); strcpy(s,"Compattamento ");
strcat(s, filename);
progind_create(100L,s,0,0,60); progind_create(100L,s,0,0,60);
} }
if (eod < d4recCount(dbdata[handle])) if (eod < d4recCount(dbdata[handle]))

View File

@ -1200,7 +1200,7 @@ TCurrency& TMask::get_currency(short fld_id, TCurrency& c) const
void TMask::set( void TMask::set(
short fld_id, // @parm Identificatore del campo da settare short fld_id, // @parm Identificatore del campo da settare
const char* s, // @parm Stringa da assegnare al campo const char* s, // @parm Stringa da assegnare al campo
bool hit) // @parm Indica se occorre rifare i controlli una volta settato il campo byte hit) // @parm Indica se occorre rifare i controlli una volta settato il campo
// con il nuovo valore (default FALSE) // con il nuovo valore (default FALSE)
// @parm long | n | Numero da asegnare al campo // @parm long | n | Numero da asegnare al campo
@ -1209,9 +1209,12 @@ void TMask::set(
{ {
TMask_field& f = field(fld_id); TMask_field& f = field(fld_id);
f.set(s); f.set(s);
if (hit && (f.active() || f.ghost())) if ((f.active() || f.ghost()))
{ {
f.set_dirty(); f.set_dirty();
if (hit & 0x2)
f.check();
if (hit & 0x1)
f.on_hit(); f.on_hit();
} }
} }
@ -1219,7 +1222,7 @@ void TMask::set(
void TMask::set( void TMask::set(
const char * fld_id, // @parm FIELD del campo da settare const char * fld_id, // @parm FIELD del campo da settare
const char* str, // @parm Stringa da assegnare al campo const char* str, // @parm Stringa da assegnare al campo
bool hit) // @parm Indica se occorre rifare i controlli una volta settato il campo byte hit) // @parm Indica se occorre rifare i controlli una volta settato il campo
// con il nuovo valore (default FALSE) // con il nuovo valore (default FALSE)
// @parm long | n | Numero da asegnare al campo // @parm long | n | Numero da asegnare al campo
@ -1235,26 +1238,26 @@ void TMask::set(
} }
} }
void TMask::set(short fld_id, long n, bool hit) void TMask::set(short fld_id, long n, byte hit)
{ {
char s[16]; char s[16];
sprintf(s, "%ld", n); sprintf(s, "%ld", n);
set(fld_id, s, hit); set(fld_id, s, hit);
} }
void TMask::set(short fld_id, const real& n, bool hit) void TMask::set(short fld_id, const real& n, byte hit)
{ {
CHECK(id2pos(fld_id) < 0 || field(fld_id).is_edit(), "Can't set a real value in a non edit field"); CHECK(id2pos(fld_id) < 0 || field(fld_id).is_edit(), "Can't set a real value in a non edit field");
set(fld_id, n.string(), hit); set(fld_id, n.string(), hit);
} }
void TMask::set(short fld_id, const TDate& d, bool hit) void TMask::set(short fld_id, const TDate& d, byte hit)
{ {
CHECK(id2pos(fld_id) < 0 || field(fld_id).is_kind_of(CLASS_DATE_FIELD), "Can't set a date in a non-date field"); CHECK(id2pos(fld_id) < 0 || field(fld_id).is_kind_of(CLASS_DATE_FIELD), "Can't set a date in a non-date field");
set(fld_id, d.string(), hit); set(fld_id, d.string(), hit);
} }
void TMask::set(short fld_id, const TCurrency& n, bool hit) void TMask::set(short fld_id, const TCurrency& n, byte hit)
{ {
CHECK(field(fld_id).is_kind_of(CLASS_CURRENCY_FIELD), "Can't set a currency in a non-currency field"); CHECK(field(fld_id).is_kind_of(CLASS_CURRENCY_FIELD), "Can't set a currency in a non-currency field");
// CHECK(id2pos(fld_id) < 0 || field(fld_id).is_edit(), "Can't set a currency in a non edit field"); // CHECK(id2pos(fld_id) < 0 || field(fld_id).is_edit(), "Can't set a currency in a non edit field");

View File

@ -268,17 +268,17 @@ public:
TTree_field& tfield(short id) const; TTree_field& tfield(short id) const;
// @cmember Setta il campo con una stringa // @cmember Setta il campo con una stringa
virtual void set(short fld_id, const char* str, bool hit=FALSE); virtual void set(short fld_id, const char* str, byte hit=0x0);
// @cmember Setta il campo con un reale // @cmember Setta il campo con un reale
void set(short fld_id, const real& num, bool hit=FALSE); void set(short fld_id, const real& num, byte hit=0x0);
// @cmember Setta il campo con una data // @cmember Setta il campo con una data
void set(short fld_id, const TDate& day, bool hit=FALSE); void set(short fld_id, const TDate& day, byte hit=0x0);
// @cmember Setta il campo con un valore // @cmember Setta il campo con un valore
void set(short fld_id, long num, bool hit=FALSE); void set(short fld_id, long num, byte hit=0x0);
// @cmember Setta il campo con un currency // @cmember Setta il campo con un currency
void set(short fld_id, const TCurrency& num, bool hit=FALSE); void set(short fld_id, const TCurrency& num, byte hit=0x0);
// @cmember Setta una tutti i campi che hanno come FIELD <p fld_id> // @cmember Setta una tutti i campi che hanno come FIELD <p fld_id>
void set(const char * fld_id, const char * str, bool hit=FALSE); void set(const char * fld_id, const char * str, byte hit=0x0);
// @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di stringa // @cmember Ritorna il contenuto del campo <p fld_id> sotto forma di stringa
virtual const TString& get(short fld_id) const; virtual const TString& get(short fld_id) const;