Aggiunto metodo TForm_number::put_paragraph(), corretto TForm_number::aplly_format()
Resa protected la TForm::change_number_format(). git-svn-id: svn://10.65.10.50/trunk@2492 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
b3bbb1a51a
commit
770a2714f9
@ -1114,7 +1114,7 @@ protected:
|
|||||||
bool set(const char*);
|
bool set(const char*);
|
||||||
|
|
||||||
TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
|
TFieldref& field(int i) const { return (TFieldref&)_field[i]; }
|
||||||
void put_paragraph(const char* s);
|
virtual void put_paragraph(const char* s);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual const int fields() { return _field.items();}
|
virtual const int fields() { return _field.items();}
|
||||||
@ -1391,7 +1391,8 @@ protected: // TForm_string
|
|||||||
virtual const char* class_name() const { return "NUMERO"; }
|
virtual const char* class_name() const { return "NUMERO"; }
|
||||||
virtual bool parse_head(TScanner& scanner);
|
virtual bool parse_head(TScanner& scanner);
|
||||||
virtual bool update();
|
virtual bool update();
|
||||||
virtual int height() const { return 0; }
|
//virtual int height() const { return 0; }
|
||||||
|
virtual void put_paragraph(const char * s);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int decimals() const { return _height; }
|
int decimals() const { return _height; }
|
||||||
@ -1413,6 +1414,23 @@ bool TForm_number::parse_head(TScanner& scanner)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void TForm_number::put_paragraph(const char* s)
|
||||||
|
{
|
||||||
|
if (hidden()) return;
|
||||||
|
|
||||||
|
int gap = 0;
|
||||||
|
if (section().columnwise())
|
||||||
|
{
|
||||||
|
const int w = width();
|
||||||
|
const int l = strlen(s);
|
||||||
|
if (w>l) gap = w-l;
|
||||||
|
}
|
||||||
|
if (_prompt.empty())
|
||||||
|
string_at(x()+gap, _y, s);
|
||||||
|
else
|
||||||
|
string_at(-1, _y, s); // se ha il prompt stampa all'ultima posizione raggiunta
|
||||||
|
}
|
||||||
|
|
||||||
bool TForm_number::update()
|
bool TForm_number::update()
|
||||||
{
|
{
|
||||||
if (read())
|
if (read())
|
||||||
@ -1445,8 +1463,9 @@ void TForm_number::apply_format(real& n , TString& s) const
|
|||||||
TToken_string delim(4, ','); // Stringa con i due delimitatori
|
TToken_string delim(4, ','); // Stringa con i due delimitatori
|
||||||
TString pic(picture()); // Picture senza delimitatori
|
TString pic(picture()); // Picture senza delimitatori
|
||||||
int maxlen = -1;
|
int maxlen = -1;
|
||||||
|
int comma = pic.find(',');
|
||||||
int at = pic.find('@');
|
int at = pic.find('@');
|
||||||
if (at >= 0)
|
if (at >= 0 && comma <0)
|
||||||
{
|
{
|
||||||
maxlen = atoi(&pic[at+1]);
|
maxlen = atoi(&pic[at+1]);
|
||||||
pic.cut(at);
|
pic.cut(at);
|
||||||
|
@ -85,10 +85,10 @@ class TForm : public TObject
|
|||||||
|
|
||||||
// come sotto ma per printsection, all'uopo di chiamarle
|
// come sotto ma per printsection, all'uopo di chiamarle
|
||||||
// con ricorsiva insistenza
|
// con ricorsiva insistenza
|
||||||
bool ps_change_date_format(TPrint_section& s, const char* f);
|
|
||||||
bool ps_change_number_format(TPrint_section& s, int w, int dec, const char* p);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
bool ps_change_date_format(TPrint_section& s, const char* f);
|
||||||
|
bool ps_change_number_format(TPrint_section& s, int w, int dec, const char* p);
|
||||||
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
TPrint_section* exist(char s, pagetype t, bool create = FALSE); // Can be NULL
|
||||||
void init(); // inizializza il form
|
void init(); // inizializza il form
|
||||||
void read(const char* form, const char* code = "", int editlevel = 0, const char* desc = ""); // carica il form dal file specificato
|
void read(const char* form, const char* code = "", int editlevel = 0, const char* desc = ""); // carica il form dal file specificato
|
||||||
@ -174,7 +174,7 @@ public:
|
|||||||
// cambia il formato di tutte le date nel form
|
// cambia il formato di tutte le date nel form
|
||||||
void change_date_format(const char* f);
|
void change_date_format(const char* f);
|
||||||
// cambia il formato di tutti i numeri nel form
|
// cambia il formato di tutti i numeri nel form
|
||||||
void change_number_format(int w, int dec, const char* p);
|
virtual void change_number_format(int w, int dec, const char* p);
|
||||||
// Rilegge la sezione specificata
|
// Rilegge la sezione specificata
|
||||||
bool reread(char sec, pagetype p, bool force=FALSE);
|
bool reread(char sec, pagetype p, bool force=FALSE);
|
||||||
// editor interface
|
// editor interface
|
||||||
|
Loading…
x
Reference in New Issue
Block a user