From 770a2714f98b4aeb0d412e4ce70162217eeef151 Mon Sep 17 00:00:00 2001 From: angelo Date: Tue, 23 Jan 1996 12:16:28 +0000 Subject: [PATCH] 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 --- include/form.cpp | 29 ++++++++++++++++++++++++----- include/form.h | 6 +++--- 2 files changed, 27 insertions(+), 8 deletions(-) diff --git a/include/form.cpp b/include/form.cpp index 2c9f6d7cc..a3796bb49 100755 --- a/include/form.cpp +++ b/include/form.cpp @@ -1114,7 +1114,7 @@ protected: bool set(const char*); TFieldref& field(int i) const { return (TFieldref&)_field[i]; } - void put_paragraph(const char* s); + virtual void put_paragraph(const char* s); public: virtual const int fields() { return _field.items();} @@ -1287,7 +1287,7 @@ bool TForm_string::read() void TForm_string::put_paragraph(const char* s) { if (hidden()) return; - + if (height() > 1) { TParagraph_string p(s, width()); @@ -1391,7 +1391,8 @@ protected: // TForm_string virtual const char* class_name() const { return "NUMERO"; } virtual bool parse_head(TScanner& scanner); virtual bool update(); - virtual int height() const { return 0; } + //virtual int height() const { return 0; } + virtual void put_paragraph(const char * s); protected: 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() { if (read()) @@ -1444,9 +1462,10 @@ void TForm_number::apply_format(real& n , TString& s) const { TToken_string delim(4, ','); // Stringa con i due delimitatori TString pic(picture()); // Picture senza delimitatori - int maxlen = -1; + int maxlen = -1; + int comma = pic.find(','); int at = pic.find('@'); - if (at >= 0) + if (at >= 0 && comma <0) { maxlen = atoi(&pic[at+1]); pic.cut(at); diff --git a/include/form.h b/include/form.h index 0506fa087..8d667ef8c 100755 --- a/include/form.h +++ b/include/form.h @@ -85,10 +85,10 @@ class TForm : public TObject // come sotto ma per printsection, all'uopo di chiamarle // 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: + 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 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 @@ -174,7 +174,7 @@ public: // cambia il formato di tutte le date nel form void change_date_format(const char* f); // 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 bool reread(char sec, pagetype p, bool force=FALSE); // editor interface