Corretta gestione listbox nelle celle e bottoni della toolbar
git-svn-id: svn://10.65.10.50/trunk@2947 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
d1745dd3cd
commit
1d80e8a48c
@ -1009,9 +1009,10 @@ void TButton_control::create(WINDOW win, short cid,
|
|||||||
rct.right++;
|
rct.right++;
|
||||||
}
|
}
|
||||||
|
|
||||||
const unsigned long attrib = flags2attr(flags);
|
|
||||||
if (wc == WC_CHECKBOX)
|
if (wc == WC_CHECKBOX)
|
||||||
rct.right += XI_FU_MULTIPLE / 2;
|
rct.right += XI_FU_MULTIPLE / 2;
|
||||||
|
|
||||||
|
const unsigned long attrib = flags2attr(flags);
|
||||||
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, &rct, attrib, (char*)t, cid);
|
XI_OBJ_DEF* def = xi_add_button_def(NULL, cid, &rct, attrib, (char*)t, cid);
|
||||||
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
CHECKD(def, "Can't create the interface of TButton_control ", cid);
|
||||||
def->v.btn->fore_color = color;
|
def->v.btn->fore_color = color;
|
||||||
@ -1510,7 +1511,7 @@ void TDropDownList::close()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDropDownList::select(int i, bool force)
|
bool TDropDownList::select(int i, bool force)
|
||||||
{
|
{
|
||||||
if (force || i != _selected)
|
if (force || i != _selected)
|
||||||
{
|
{
|
||||||
@ -1537,10 +1538,14 @@ void TDropDownList::select(int i, bool force)
|
|||||||
XI_OBJ cell; XI_MAKE_CELL(&cell, _xi_lst, r, 0);
|
XI_OBJ cell; XI_MAKE_CELL(&cell, _xi_lst, r, 0);
|
||||||
xi_set_focus(&cell);
|
xi_set_focus(&cell);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDropDownList::select_by_initial(char c)
|
bool TDropDownList::select_by_initial(char c)
|
||||||
{
|
{
|
||||||
int next = _selected < _values.items() - 1 ? _selected + 1 : 0;
|
int next = _selected < _values.items() - 1 ? _selected + 1 : 0;
|
||||||
int first = -1;
|
int first = -1;
|
||||||
@ -1550,22 +1555,24 @@ void TDropDownList::select_by_initial(char c)
|
|||||||
first = i;
|
first = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (first == -1) return;
|
if (first == -1)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
for (i = next; i < _values.items(); i++)
|
for (i = next; i < _values.items(); i++)
|
||||||
if (toupper(*(_values.get(i))) == toupper(c))
|
if (toupper(*(_values.get(i))) == toupper(c))
|
||||||
{
|
|
||||||
select(i);
|
|
||||||
break;
|
break;
|
||||||
}
|
if (i == _values.items() && first >= 0)
|
||||||
if (i == _values.items() && first > -1)
|
i = first;
|
||||||
select(first);
|
|
||||||
|
return select(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TDropDownList::select_by_ofs(int i)
|
bool TDropDownList::select_by_ofs(int i)
|
||||||
{
|
{
|
||||||
i += _selected;
|
i += _selected;
|
||||||
if (i >= 0 && i < _values.items())
|
if (i >= 0 && i < _values.items())
|
||||||
select(i);
|
return select(i);
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
TDropDownList::TDropDownList(XI_OBJ* o, const char* codes, const char* values, int width)
|
TDropDownList::TDropDownList(XI_OBJ* o, const char* codes, const char* values, int width)
|
||||||
|
@ -1,329 +1,330 @@
|
|||||||
#ifndef __CONTROLS_H
|
#ifndef __CONTROLS_H
|
||||||
#define __CONTROLS_H
|
#define __CONTROLS_H
|
||||||
|
|
||||||
#ifndef __STRINGS_H
|
#ifndef __STRINGS_H
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class TWindow; // __WINDOW_H
|
class TWindow; // __WINDOW_H
|
||||||
class TMask_field; // __MASKFLD_H
|
class TMask_field; // __MASKFLD_H
|
||||||
|
|
||||||
#ifndef INCL_XI
|
#ifndef INCL_XI
|
||||||
#define XI_INTERNAL
|
#define XI_INTERNAL
|
||||||
#include <xi.h>
|
#include <xi.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
void init_controls();
|
void init_controls();
|
||||||
void free_controls();
|
void free_controls();
|
||||||
XVT_FNTID xvt_default_font(bool bold = FALSE);
|
XVT_FNTID xvt_default_font(bool bold = FALSE);
|
||||||
|
|
||||||
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy,
|
||||||
const char* caption, TWindow* mask, bool tags);
|
const char* caption, TWindow* mask, bool tags);
|
||||||
|
|
||||||
void attach_interface(WINDOW win, COLOR back = COLOR_WHITE);
|
void attach_interface(WINDOW win, COLOR back = COLOR_WHITE);
|
||||||
short get_focus_id(WINDOW win);
|
short get_focus_id(WINDOW win);
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Custom control
|
// Custom control
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
// @doc INTERNAL
|
// @doc INTERNAL
|
||||||
|
|
||||||
// @class TControl | Classe per la creazione di controlli
|
// @class TControl | Classe per la creazione di controlli
|
||||||
class TControl : public TObject
|
class TControl : public TObject
|
||||||
// @author:(INTERNAL) Guido
|
// @author:(INTERNAL) Guido
|
||||||
|
|
||||||
// @access:(INTERNAL) Private Member
|
// @access:(INTERNAL) Private Member
|
||||||
{
|
{
|
||||||
|
|
||||||
// @access Protected Member
|
// @access Protected Member
|
||||||
protected:
|
protected:
|
||||||
// @cmember:(INTERNAL) Puntatore al controllo creato
|
// @cmember:(INTERNAL) Puntatore al controllo creato
|
||||||
XI_OBJ* _obj;
|
XI_OBJ* _obj;
|
||||||
|
|
||||||
// @cmember:(INTERNAL) Puntatore al TMask_field eventualmente associato
|
// @cmember:(INTERNAL) Puntatore al TMask_field eventualmente associato
|
||||||
TMask_field* _fld;
|
TMask_field* _fld;
|
||||||
|
|
||||||
// @cmember Ricava l'interfaccia da una finestra
|
// @cmember Ricava l'interfaccia da una finestra
|
||||||
XI_OBJ* get_interface(WINDOW win = NULL_WIN) const;
|
XI_OBJ* get_interface(WINDOW win = NULL_WIN) const;
|
||||||
|
|
||||||
// @cmember Cerca un controllo operabile (in avanti o all'indietro)
|
// @cmember Cerca un controllo operabile (in avanti o all'indietro)
|
||||||
TControl& find_operable_ctl(bool forward) const;
|
TControl& find_operable_ctl(bool forward) const;
|
||||||
|
|
||||||
// @cmember Setta l'identificatore del prossimo controllo per il tasto TAB
|
// @cmember Setta l'identificatore del prossimo controllo per il tasto TAB
|
||||||
void set_tab_cid(short id);
|
void set_tab_cid(short id);
|
||||||
|
|
||||||
void coord2rct(WINDOW win, short left, short top, short width, short height, RCT& rct) const;
|
void coord2rct(WINDOW win, short left, short top, short width, short height, RCT& rct) const;
|
||||||
unsigned long flags2attr(const char* flags) const;
|
unsigned long flags2attr(const char* flags) const;
|
||||||
void update_tab_cid();
|
void update_tab_cid();
|
||||||
const char* parse_caption(const char* cap, bool& bold, COLOR& color) const;
|
const char* parse_caption(const char* cap, bool& bold, COLOR& color) const;
|
||||||
|
|
||||||
void change_attrib(unsigned long attr, bool on, XI_OBJ* obj = NULL);
|
void change_attrib(unsigned long attr, bool on, XI_OBJ* obj = NULL);
|
||||||
|
|
||||||
bool notify_key(KEY k);
|
bool notify_key(KEY k);
|
||||||
|
|
||||||
// @access Public Member
|
// @access Public Member
|
||||||
public:
|
public:
|
||||||
TControl();
|
TControl();
|
||||||
virtual ~TControl();
|
virtual ~TControl();
|
||||||
|
|
||||||
static KEY xiev_to_key(const XI_EVENT* xiev);
|
static KEY xiev_to_key(const XI_EVENT* xiev);
|
||||||
|
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
||||||
|
|
||||||
bool is_edit_key(KEY k) const;
|
bool is_edit_key(KEY k) const;
|
||||||
|
|
||||||
// @cmember Ritorna l'identificatore assegnato al controllo
|
// @cmember Ritorna l'identificatore assegnato al controllo
|
||||||
short id() const { return _obj->cid; }
|
short id() const { return _obj->cid; }
|
||||||
WINDOW parent() const;
|
WINDOW parent() const;
|
||||||
|
|
||||||
XI_OBJ_TYPE type() const { return _obj->type; }
|
XI_OBJ_TYPE type() const { return _obj->type; }
|
||||||
|
|
||||||
// @cmember Ritorna il prompt del controllo
|
// @cmember Ritorna il prompt del controllo
|
||||||
const char* caption() const;
|
const char* caption() const;
|
||||||
// @cmember Setta il prompt del controllo
|
// @cmember Setta il prompt del controllo
|
||||||
virtual void set_caption(const char* c);
|
virtual void set_caption(const char* c);
|
||||||
|
|
||||||
// @cmember Abilita/disabilita il controllo
|
// @cmember Abilita/disabilita il controllo
|
||||||
virtual void enable(bool on = TRUE);
|
virtual void enable(bool on = TRUE);
|
||||||
void disable() { enable(FALSE); }
|
void disable() { enable(FALSE); }
|
||||||
|
|
||||||
// @cmember Mostra/nasconde il controllo
|
// @cmember Mostra/nasconde il controllo
|
||||||
virtual void show(bool on = TRUE);
|
virtual void show(bool on = TRUE);
|
||||||
void hide() { show(FALSE); }
|
void hide() { show(FALSE); }
|
||||||
|
|
||||||
void autoselect(bool on);
|
void autoselect(bool on);
|
||||||
|
|
||||||
// @cmember Forza il focus al controllo
|
// @cmember Forza il focus al controllo
|
||||||
virtual void set_focus() const;
|
virtual void set_focus() const;
|
||||||
|
|
||||||
RCT& get_rect(RCT& r) const;
|
RCT& get_rect(RCT& r) const;
|
||||||
virtual void set_rect(const RCT& r);
|
virtual void set_rect(const RCT& r);
|
||||||
|
|
||||||
bool on_key(KEY k);
|
bool on_key(KEY k);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TText_control : public TControl
|
class TText_control : public TControl
|
||||||
{
|
{
|
||||||
public: // TControl
|
public: // TControl
|
||||||
virtual void set_caption(const char* text);
|
virtual void set_caption(const char* text);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TText_control(WINDOW win, short cid,
|
TText_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TText_control() {}
|
virtual ~TText_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TGroupbox_control : public TText_control
|
class TGroupbox_control : public TText_control
|
||||||
{
|
{
|
||||||
XI_OBJ* _rct; // Rettangolo del gruppo
|
XI_OBJ* _rct; // Rettangolo del gruppo
|
||||||
|
|
||||||
public: // TControl
|
public: // TControl
|
||||||
virtual void show(bool on);
|
virtual void show(bool on);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TGroupbox_control(WINDOW win, short cid,
|
TGroupbox_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TGroupbox_control() {}
|
virtual ~TGroupbox_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TField_control : public TControl
|
class TField_control : public TControl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
|
|
||||||
void create(WINDOW win, short cid,
|
void create(WINDOW win, short cid,
|
||||||
short left, short top,
|
short left, short top,
|
||||||
short width, short height, short maxlen,
|
short width, short height, short maxlen,
|
||||||
const char* flags, const char* text, bool button);
|
const char* flags, const char* text, bool button);
|
||||||
|
|
||||||
TField_control() {}
|
TField_control() {}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @cmember Mostra o nasconde il bottone associato
|
// @cmember Mostra o nasconde il bottone associato
|
||||||
void show_button(bool on);
|
void show_button(bool on);
|
||||||
|
|
||||||
// @cmember Forza il focus al controllo
|
// @cmember Forza il focus al controllo
|
||||||
virtual void set_focus() const;
|
virtual void set_focus() const;
|
||||||
|
|
||||||
TField_control(WINDOW win, short cid,
|
TField_control(WINDOW win, short cid,
|
||||||
short left, short top,
|
short left, short top,
|
||||||
short width, short maxlen,
|
short width, short maxlen,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TField_control() {}
|
virtual ~TField_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TMultiline_control : public TField_control
|
class TMultiline_control : public TField_control
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TMultiline_control(WINDOW win, short cid,
|
TMultiline_control(WINDOW win, short cid,
|
||||||
short left, short top,
|
short left, short top,
|
||||||
short width, short height, short maxlen,
|
short width, short height, short maxlen,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TMultiline_control() {}
|
virtual ~TMultiline_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class TButton_control : public TControl
|
class TButton_control : public TControl
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void create(WINDOW win, short cid,
|
void create(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text,
|
const char* flags, const char* text,
|
||||||
WIN_TYPE wc, XI_OBJ* container);
|
WIN_TYPE wc, XI_OBJ* container);
|
||||||
|
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* ep);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void set_rect(const RCT& r);
|
virtual void set_rect(const RCT& r);
|
||||||
|
|
||||||
bool checked() const;
|
bool checked() const;
|
||||||
void check(bool on = TRUE);
|
void check(bool on = TRUE);
|
||||||
void uncheck() { check(FALSE); }
|
void uncheck() { check(FALSE); }
|
||||||
bool toggle();
|
bool toggle();
|
||||||
|
|
||||||
XI_BTN_TYPE button_type() const;
|
XI_BTN_TYPE button_type() const;
|
||||||
XI_OBJ* container() const;
|
XI_OBJ* container() const;
|
||||||
|
|
||||||
TButton_control() {}
|
TButton_control() {}
|
||||||
virtual ~TButton_control() {}
|
virtual ~TButton_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TPushbutton_control : public TButton_control
|
class TPushbutton_control : public TButton_control
|
||||||
{
|
{
|
||||||
short _bmp_up, _bmp_dn;
|
short _bmp_up, _bmp_dn;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual void update();
|
virtual void update();
|
||||||
|
|
||||||
void set_bmp(short up, short dn);
|
void set_bmp(short up, short dn);
|
||||||
|
|
||||||
TPushbutton_control(WINDOW win, short cid,
|
TPushbutton_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text,
|
const char* flags, const char* text,
|
||||||
short bmp_up = 0, short _bmp_dn = 0);
|
short bmp_up = 0, short _bmp_dn = 0);
|
||||||
virtual ~TPushbutton_control() {}
|
virtual ~TPushbutton_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TRadiobutton_control : public TButton_control
|
class TRadiobutton_control : public TButton_control
|
||||||
{
|
{
|
||||||
protected: // TControl
|
protected: // TControl
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
virtual void set_focus() const;
|
virtual void set_focus() const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TRadiobutton_control() { } // To be derived
|
TRadiobutton_control() { } // To be derived
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// @cmember Abilita/disabilita il controllo
|
// @cmember Abilita/disabilita il controllo
|
||||||
virtual void enable(bool on = TRUE);
|
virtual void enable(bool on = TRUE);
|
||||||
// @cmember Mostra/nasconde il controllo
|
// @cmember Mostra/nasconde il controllo
|
||||||
virtual void show(bool on = TRUE);
|
virtual void show(bool on = TRUE);
|
||||||
|
|
||||||
byte get_checked() const;
|
byte get_checked() const;
|
||||||
void check_button(byte b);
|
void check_button(byte b);
|
||||||
|
|
||||||
void show_button(byte b, bool on = TRUE);
|
void show_button(byte b, bool on = TRUE);
|
||||||
void hide_button(byte b) { show_button(b, FALSE); }
|
void hide_button(byte b) { show_button(b, FALSE); }
|
||||||
|
|
||||||
TRadiobutton_control(WINDOW win, short cid,
|
TRadiobutton_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TRadiobutton_control() {}
|
virtual ~TRadiobutton_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TTagbutton_control : public TRadiobutton_control
|
class TTagbutton_control : public TRadiobutton_control
|
||||||
{
|
{
|
||||||
protected: // TControl
|
protected: // TControl
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
TTagbutton_control(WINDOW win, short cid,
|
TTagbutton_control(WINDOW win, short cid,
|
||||||
short left, short top, short width, short height,
|
short left, short top, short width, short height,
|
||||||
const char* flags, const char* text, int tag);
|
const char* flags, const char* text, int tag);
|
||||||
virtual ~TTagbutton_control() {}
|
virtual ~TTagbutton_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class TCheckbox_control : public TButton_control
|
class TCheckbox_control : public TButton_control
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TCheckbox_control(WINDOW win, short cid,
|
TCheckbox_control(WINDOW win, short cid,
|
||||||
short left, short top, short width,
|
short left, short top, short width,
|
||||||
const char* flags, const char* text);
|
const char* flags, const char* text);
|
||||||
virtual ~TCheckbox_control() {}
|
virtual ~TCheckbox_control() {}
|
||||||
};
|
};
|
||||||
|
|
||||||
class TDropDownList : public TObject
|
class TDropDownList : public TObject
|
||||||
{
|
{
|
||||||
XI_OBJ* _obj;
|
XI_OBJ* _obj;
|
||||||
XI_OBJ* _xi_lst;
|
XI_OBJ* _xi_lst;
|
||||||
|
|
||||||
TToken_string _codes;
|
TToken_string _codes;
|
||||||
TToken_string _values;
|
TToken_string _values;
|
||||||
|
|
||||||
int _selected;
|
int _selected;
|
||||||
int _width;
|
int _width;
|
||||||
bool _open;
|
bool _open;
|
||||||
bool _displayed;
|
bool _displayed;
|
||||||
bool _in_cell;
|
bool _in_cell;
|
||||||
|
|
||||||
static void ddl_str_eh (XI_OBJ* itf, XI_EVENT* xiev);
|
static void ddl_str_eh (XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const int selected() const { return _selected; }
|
const int selected() const { return _selected; }
|
||||||
void select_by_initial(char c);
|
void open();
|
||||||
void select_by_ofs(int n);
|
void close();
|
||||||
void open();
|
bool is_open() const { return _open; }
|
||||||
void close();
|
bool displayed() const { return _displayed; }
|
||||||
bool is_open() const { return _open; }
|
|
||||||
bool displayed() const { return _displayed; }
|
const char* item(int i) { return _values.get(i); }
|
||||||
|
int items() const { return _values.items(); }
|
||||||
const char* item(int i) { return _values.get(i); }
|
long row2rec(int) const;
|
||||||
int items() const { return _values.items(); }
|
int rec2row(long rec) const;
|
||||||
long row2rec(int) const;
|
void set_values(const char* c, const char* v);
|
||||||
int rec2row(long rec) const;
|
|
||||||
void select(int i, bool force = FALSE);
|
bool select(int i, bool force = FALSE);
|
||||||
void set_values(const char* c, const char* v);
|
bool select_by_initial(char c);
|
||||||
|
bool select_by_ofs(int n);
|
||||||
TDropDownList(XI_OBJ* o, const char* codes, const char* values, int wid);
|
|
||||||
virtual ~TDropDownList() {}
|
TDropDownList(XI_OBJ* o, const char* codes, const char* values, int wid);
|
||||||
};
|
virtual ~TDropDownList() {}
|
||||||
|
};
|
||||||
class TListbox_control : public TField_control
|
|
||||||
{
|
class TListbox_control : public TField_control
|
||||||
friend class TDropDownList;
|
{
|
||||||
TDropDownList* _ddl;
|
friend class TDropDownList;
|
||||||
|
TDropDownList* _ddl;
|
||||||
private:
|
|
||||||
void drop_down();
|
private:
|
||||||
|
void drop_down();
|
||||||
protected: // TTField_control
|
|
||||||
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
protected: // TTField_control
|
||||||
|
virtual bool event_handler(XI_OBJ* itf, XI_EVENT* xiev);
|
||||||
public:
|
|
||||||
void set_values(const char* c, const char* v);
|
public:
|
||||||
int items() const { return _ddl->items(); }
|
void set_values(const char* c, const char* v);
|
||||||
void select(int i) { _ddl->select(i); }
|
int items() const { return _ddl->items(); }
|
||||||
void select_by_initial(char c) { _ddl->select_by_initial(c); }
|
bool select(int i) { return _ddl->select(i); }
|
||||||
void select_by_ofs(int i) { _ddl->select_by_ofs(i); }
|
bool select_by_initial(char c) { return _ddl->select_by_initial(c); }
|
||||||
int selected() const { return _ddl->selected(); }
|
bool select_by_ofs(int i) { return _ddl->select_by_ofs(i); }
|
||||||
|
int selected() const { return _ddl->selected(); }
|
||||||
TListbox_control(WINDOW win, short cid,
|
|
||||||
short left, short top, short width,
|
TListbox_control(WINDOW win, short cid,
|
||||||
const char* flags, const char* text,
|
short left, short top, short width,
|
||||||
const char* codes, const char* values);
|
const char* flags, const char* text,
|
||||||
virtual ~TListbox_control();
|
const char* codes, const char* values);
|
||||||
};
|
virtual ~TListbox_control();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
#endif
|
||||||
|
@ -1080,9 +1080,18 @@ bool TButton_field::on_key(KEY key)
|
|||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
if (key == K_SPACE)
|
if (key == K_SPACE)
|
||||||
{
|
{
|
||||||
ok = on_hit();
|
if (dlg() != DLG_CANCEL && dlg() != DLG_QUIT)
|
||||||
if (ok && _exit_key > 0 && message(0) == NULL)
|
{
|
||||||
mask().stop_run(_exit_key);
|
const TMask& m = mask();
|
||||||
|
if (parent() == m.toolwin())
|
||||||
|
ok = m.focus_field().on_key(K_TAB);
|
||||||
|
}
|
||||||
|
if (ok)
|
||||||
|
{
|
||||||
|
ok = on_hit();
|
||||||
|
if (ok && _exit_key > 0 && !has_message())
|
||||||
|
mask().stop_run(_exit_key);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ok = TOperable_field::on_key(key);
|
ok = TOperable_field::on_key(key);
|
||||||
@ -1719,7 +1728,8 @@ void TBrowse::parse_input(TScanner& scanner)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
else // Field on the mask
|
else // Field on the mask
|
||||||
{
|
{
|
||||||
|
CHECKS(_inp_id.get_pos(s) < 0, "Duplicate input field ", s);
|
||||||
_inp_id.add(s);
|
_inp_id.add(s);
|
||||||
if (scanner.popkey() == "SE") _inp_id << '@'; // Special FILTERing field
|
if (scanner.popkey() == "SE") _inp_id << '@'; // Special FILTERing field
|
||||||
else scanner.push();
|
else scanner.push();
|
||||||
@ -1862,6 +1872,12 @@ const char* TBrowse::get_input_fields() const
|
|||||||
return _inp_id;
|
return _inp_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char* TBrowse::get_input_field_names() const
|
||||||
|
{
|
||||||
|
return _inp_fn;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
const char* TBrowse::get_output_fields() const
|
const char* TBrowse::get_output_fields() const
|
||||||
{
|
{
|
||||||
return _out_id;
|
return _out_id;
|
||||||
@ -3564,16 +3580,20 @@ const char* TList_field::raw2win(const char* data) const
|
|||||||
return value.get(pos);
|
return value.get(pos);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TList_field::select_by_ofs(int n)
|
bool TList_field::select_by_ofs(int n)
|
||||||
{
|
{
|
||||||
((TListbox_control*)_ctl)->select_by_ofs(n);
|
const bool changed = ((TListbox_control*)_ctl)->select_by_ofs(n);
|
||||||
_str = _codes.get(current());
|
if (changed)
|
||||||
|
_str = _codes.get(current());
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TList_field::select_by_initial(char c)
|
bool TList_field::select_by_initial(char c)
|
||||||
{
|
{
|
||||||
((TListbox_control*)_ctl)->select_by_initial(c);
|
const bool changed = ((TListbox_control*)_ctl)->select_by_initial(c);
|
||||||
_str = _codes.get(current());
|
if (changed)
|
||||||
|
_str = _codes.get(current());
|
||||||
|
return changed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
@ -3588,7 +3608,6 @@ void TList_field::replace_items(
|
|||||||
{
|
{
|
||||||
_codes = codes;
|
_codes = codes;
|
||||||
_values = values;
|
_values = values;
|
||||||
|
|
||||||
if (_ctl)
|
if (_ctl)
|
||||||
add_list();
|
add_list();
|
||||||
}
|
}
|
||||||
@ -3633,8 +3652,8 @@ int TList_field::str2curr(const char* data)
|
|||||||
if (i < 0)
|
if (i < 0)
|
||||||
{
|
{
|
||||||
if (items() && str.not_empty())
|
if (items() && str.not_empty())
|
||||||
yesnofatal_box("'%s' non e' un valore valido per il campo %s: %d",
|
NFCHECK("'%s' non e' un valore valido per il campo %s: %d",
|
||||||
data, prompt(), dlg());
|
data, prompt(), dlg());
|
||||||
i = 0;
|
i = 0;
|
||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
@ -3656,7 +3675,7 @@ void TList_field::set(const char* data)
|
|||||||
|
|
||||||
void TList_field::set_window_data(const char* data)
|
void TList_field::set_window_data(const char* data)
|
||||||
{
|
{
|
||||||
CHECK(0,"So' passato da 'sta stronza!!!");
|
NFCHECK(0,"So' passato da 'sta stronza!!!");
|
||||||
const int i = str2curr(win2raw(data));
|
const int i = str2curr(win2raw(data));
|
||||||
current(i);
|
current(i);
|
||||||
}
|
}
|
||||||
|
2687
include/maskfld.h
2687
include/maskfld.h
File diff suppressed because it is too large
Load Diff
@ -1,276 +1,260 @@
|
|||||||
#include <defmask.h>
|
#include <defmask.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
|
|
||||||
const char* const TITLE_TEXT = "Attesa";
|
const char* const TITLE_TEXT = "Attesa";
|
||||||
|
|
||||||
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
word TIndwin::measure_text(TToken_string& s, word& maxlen) const
|
||||||
{
|
{
|
||||||
word lines = 0;
|
word lines = 0;
|
||||||
for(const char* t = s.get(0); t; t = s.get())
|
for(const char* t = s.get(0); t; t = s.get())
|
||||||
{
|
{
|
||||||
const word l = strlen(t);
|
const word l = strlen(t);
|
||||||
if (l > maxlen) maxlen = l;
|
if (l > maxlen) maxlen = l;
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Certified 70%
|
// Certified 70%
|
||||||
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
TIndwin::TIndwin(long max, const char* txt, bool cancel, bool bar, int div)
|
||||||
: _text(NULL), _cancel(NULL), _bar(0),
|
: _text(NULL), _cancel(NULL), _bar(0),
|
||||||
_status(0L), _max(max), _flags(0x0)
|
_status(0L), _max(max), _flags(0x0)
|
||||||
{
|
{
|
||||||
if (_max <= 0) _max = 1;
|
if (_max <= 0) _max = 1;
|
||||||
|
|
||||||
TToken_string testo(txt, '\n');
|
TToken_string testo(txt, '\n');
|
||||||
word maxlen = div;
|
word maxlen = div;
|
||||||
const word lines = measure_text(testo, maxlen);
|
const word lines = measure_text(testo, maxlen);
|
||||||
|
|
||||||
int ver = lines+2;
|
int ver = lines+2;
|
||||||
|
|
||||||
int hor = maxlen+2; if (hor > 78) hor = 78;
|
int hor = maxlen+2; if (hor > 78) hor = 78;
|
||||||
|
|
||||||
if (bar)
|
if (bar)
|
||||||
{
|
{
|
||||||
_bar = ver * CHARY;
|
_bar = ver * CHARY;
|
||||||
ver += 2;
|
ver += 2;
|
||||||
}
|
}
|
||||||
ver += cancel ? 2 : 0;
|
ver += cancel ? 2 : 0;
|
||||||
|
|
||||||
set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE));
|
set_win(create_interface(TASK_WIN, -1, -1, hor, ver, TITLE_TEXT, this, FALSE));
|
||||||
|
|
||||||
_text = new TMultiline_control(win(), DLG_NULL, 1, 1, hor-2, lines, 512, "CD", "");
|
_text = new TMultiline_control(win(), DLG_NULL, 1, 1, hor-2, lines, 512, "CD", "");
|
||||||
|
|
||||||
testo.replace('\n', '\r');
|
testo.replace('\n', '\r');
|
||||||
_text->set_caption(testo);
|
_text->set_caption(testo);
|
||||||
|
|
||||||
if (cancel)
|
if (cancel)
|
||||||
{
|
{
|
||||||
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 10, 2, "", "Annulla", BMP_CANCEL);
|
_cancel = new TPushbutton_control(win(), DLG_CANCEL, -11, -1, 10, 2, "", "Annulla", BMP_CANCEL);
|
||||||
}
|
}
|
||||||
open_modal();
|
open_modal();
|
||||||
do_events();
|
do_events();
|
||||||
}
|
}
|
||||||
|
|
||||||
// @doc EXTERNAL
|
// @doc EXTERNAL
|
||||||
|
|
||||||
// @mfunc Setta il testo della finestra
|
// @mfunc Setta il testo della finestra
|
||||||
void TIndwin::set_text(
|
void TIndwin::set_text(
|
||||||
const char* t) // @parm Testo della finestra
|
const char* t) // @parm Testo della finestra
|
||||||
|
|
||||||
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
// @comm Si puo' chiamare questa funzione per cambiare il testo, ma
|
||||||
// le dimensioni della finestra sono calcolate sul primo testo
|
// le dimensioni della finestra sono calcolate sul primo testo
|
||||||
// passato, quindi occorre dimensionare correttamente il primo passato
|
// passato, quindi occorre dimensionare correttamente il primo passato
|
||||||
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
// (es. inserire degli spazi) se se ne prevede uno piu' lungo.
|
||||||
{
|
{
|
||||||
_text->set_caption(t);
|
_text->set_caption(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
TIndwin::~TIndwin()
|
TIndwin::~TIndwin()
|
||||||
{
|
{
|
||||||
close_modal();
|
close_modal();
|
||||||
|
|
||||||
if (_text) delete _text;
|
if (_text) delete _text;
|
||||||
if (_cancel) delete _cancel;
|
if (_cancel) delete _cancel;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TIndwin::can_be_closed() const
|
bool TIndwin::can_be_closed() const
|
||||||
{
|
{
|
||||||
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
const bool ok = (_flags & IND_FINISHED) || (_flags & IND_CANCELLED);
|
||||||
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
if (!ok) error_box("Attendere la fine dell'operazione prima di chiudere l'applicazione");
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
KEY TIndwin::check_stop()
|
KEY TIndwin::check_stop()
|
||||||
{
|
{
|
||||||
KEY k = 0;
|
KEY k = 0;
|
||||||
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
if ((_flags & IND_FINISHED) || (_flags & IND_CANCELLED))
|
||||||
{
|
{
|
||||||
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
k = (_flags & IND_FINISHED) ? K_ENTER : K_ESC;
|
||||||
stop_run(k);
|
stop_run(k);
|
||||||
}
|
}
|
||||||
return k;
|
return k;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TIndwin::update_bar()
|
void TIndwin::update_bar()
|
||||||
{
|
{
|
||||||
if (_status >= _max)
|
if (_status >= _max)
|
||||||
{
|
{
|
||||||
_status = _max;
|
_status = _max;
|
||||||
_flags |= IND_FINISHED;
|
_flags |= IND_FINISHED;
|
||||||
}
|
}
|
||||||
|
|
||||||
const double prc = (double)_status/_max;
|
// Percentuale raggiunta finora
|
||||||
|
const double prc = (double)_status/_max;
|
||||||
RCT r; xvt_vobj_get_client_rect(win(), &r);
|
|
||||||
r.left = CHARX; r.right -= CHARX;
|
WINDOW w = win();
|
||||||
r.top = (int)_bar;
|
RCT r; xvt_vobj_get_client_rect(w, &r);
|
||||||
r.bottom = r.top + 2*CHARY;
|
|
||||||
|
// Rettangolo contenente l'intera barra
|
||||||
RCT b = r;
|
r.left = CHARX; r.right -= CHARX;
|
||||||
|
r.top = (int)_bar;
|
||||||
/*
|
r.bottom = r.top + 2*CHARY;
|
||||||
set_pen(COLOR_BLACK);
|
|
||||||
const int width = r.right - r.left;
|
RCT b = r;
|
||||||
set_brush(COLOR_BLUE);
|
// Rettangolo in rilievo
|
||||||
b.right = b.left + int(width*prc);
|
b.right = b.left + int((r.right-r.left)*prc);
|
||||||
xvt_dwin_draw_rect(win(), &b);
|
xi_draw_3d_rect(w, &b, FALSE, 2, 0, 0, 0);
|
||||||
|
// Rettangolo scavato
|
||||||
set_brush(COLOR_WHITE);
|
b.left = b.right; b.right = r.right;
|
||||||
b.left = b.right; b.right = r.right;
|
xi_draw_3d_rect(w, &b, TRUE, 2, 0, 0, 0);
|
||||||
xvt_dwin_draw_rect(win(), &b);
|
|
||||||
|
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
||||||
set_mode(M_XOR);
|
xvt_dwin_draw_text(w, r.left+r.right/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
||||||
xvt_dwin_set_fore_color(win(), COLOR_BLUE);
|
|
||||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
check_stop();
|
||||||
xvt_dwin_draw_text(win(), r.left+width/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
}
|
||||||
set_mode(M_COPY);
|
|
||||||
*/
|
void TIndwin::update()
|
||||||
|
{
|
||||||
WINDOW w = win();
|
if (_bar) update_bar();
|
||||||
b.right = b.left + int(r.right*prc);
|
}
|
||||||
xi_draw_3d_rect(w, &b, FALSE, 2, 0, 0, 0);
|
|
||||||
|
bool TIndwin::on_key(KEY k)
|
||||||
set_brush(COLOR_WHITE);
|
{
|
||||||
b.left = b.right; b.right = r.right;
|
if (k == K_ESC && _cancel)
|
||||||
xi_draw_3d_rect(w, &b, TRUE, 2, 0, 0, 0);
|
{
|
||||||
|
_flags |= IND_CANCELLED;
|
||||||
char n[8]; sprintf(n, "%d%%", int(100*prc));
|
check_stop();
|
||||||
xvt_dwin_draw_text(w, r.left+r.right/2-CHARX, (r.bottom+r.top+CHARY)/2-3, n, -1);
|
}
|
||||||
|
return TRUE;
|
||||||
check_stop();
|
}
|
||||||
}
|
|
||||||
|
void TIndwin::on_button(short id)
|
||||||
void TIndwin::update()
|
{
|
||||||
{
|
if (id == DLG_CANCEL)
|
||||||
if (_bar) update_bar();
|
on_key(K_ESC);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TIndwin::on_key(KEY k)
|
|
||||||
{
|
// TProgind --------------------------------------------------------------
|
||||||
if (k == K_ESC && _cancel)
|
|
||||||
{
|
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
||||||
_flags |= IND_CANCELLED;
|
: TIndwin(max, txt, cancel, bar, div)
|
||||||
check_stop();
|
{}
|
||||||
}
|
|
||||||
return TRUE;
|
// TTimerind ------------------------------------------------------------
|
||||||
}
|
|
||||||
|
long TTimerind::_timer_id = 0L;
|
||||||
void TIndwin::on_button(short id)
|
|
||||||
{
|
void TTimerind::handler(WINDOW w, EVENT* e)
|
||||||
if (id == DLG_CANCEL)
|
{
|
||||||
on_key(K_ESC);
|
switch(e->type)
|
||||||
}
|
{
|
||||||
|
case E_CREATE:
|
||||||
|
case E_UPDATE:
|
||||||
// TProgind --------------------------------------------------------------
|
if (_status == 0L)
|
||||||
|
_timer_id = xvt_timer_create(w, _interval);
|
||||||
TProgind::TProgind(long max, const char* txt, bool cancel, bool bar, int div)
|
break;
|
||||||
: TIndwin(max, txt, cancel, bar, div)
|
case E_TIMER:
|
||||||
{}
|
if (e->v.timer.id == _timer_id)
|
||||||
|
{
|
||||||
// TTimerind ------------------------------------------------------------
|
_status += _interval;
|
||||||
|
force_update();
|
||||||
long TTimerind::_timer_id = 0L;
|
xvt_timer_create(w, _interval);
|
||||||
|
}
|
||||||
void TTimerind::handler(WINDOW w, EVENT* e)
|
break;
|
||||||
{
|
default:
|
||||||
switch(e->type)
|
break;
|
||||||
{
|
}
|
||||||
case E_CREATE:
|
TIndwin::handler(w,e);
|
||||||
case E_UPDATE:
|
}
|
||||||
if (_status == 0L)
|
|
||||||
_timer_id = xvt_timer_create(w, _interval);
|
TTimerind::TTimerind(long msec, const char* txt,
|
||||||
break;
|
bool cancel, bool bar, int div, int i) :
|
||||||
case E_TIMER:
|
TIndwin(msec, txt, cancel, bar, div)
|
||||||
if (e->v.timer.id == _timer_id)
|
{
|
||||||
{
|
_interval = i;
|
||||||
_status += _interval;
|
_timer_id = 0L;
|
||||||
force_update();
|
}
|
||||||
xvt_timer_create(w, _interval);
|
|
||||||
}
|
TTimerind::~TTimerind()
|
||||||
break;
|
{ xvt_timer_destroy(_timer_id); }
|
||||||
default:
|
|
||||||
break;
|
// C-style binding
|
||||||
}
|
// uses static pointer for single instance of TIndwin
|
||||||
TIndwin::handler(w,e);
|
|
||||||
}
|
static TIndwin* __indwin__p = NULL;
|
||||||
|
|
||||||
TTimerind::TTimerind(long msec, const char* txt,
|
void progind_create(long m, char* t, bool b, bool c, int n)
|
||||||
bool cancel, bool bar, int div, int i) :
|
{
|
||||||
TIndwin(msec, txt, cancel, bar, div)
|
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||||
{
|
__indwin__p = new TProgind(m,t,b,c,n);
|
||||||
_interval = i;
|
}
|
||||||
_timer_id = 0L;
|
|
||||||
}
|
void progind_set_status(long l)
|
||||||
|
{
|
||||||
TTimerind::~TTimerind()
|
((TProgind*)__indwin__p)->setstatus(l);
|
||||||
{ xvt_timer_destroy(_timer_id); }
|
}
|
||||||
|
|
||||||
// C-style binding
|
void progind_cancel()
|
||||||
// uses static pointer for single instance of TIndwin
|
{
|
||||||
|
__indwin__p->cancel();
|
||||||
static TIndwin* __indwin__p = NULL;
|
}
|
||||||
|
|
||||||
void progind_create(long m, char* t, bool b, bool c, int n)
|
bool progind_iscancelled()
|
||||||
{
|
{
|
||||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
return __indwin__p->iscancelled();
|
||||||
__indwin__p = new TProgind(m,t,b,c,n);
|
}
|
||||||
}
|
|
||||||
|
bool progind_isfinished()
|
||||||
void progind_set_status(long l)
|
{
|
||||||
{
|
return __indwin__p->isfinished();
|
||||||
((TProgind*)__indwin__p)->setstatus(l);
|
}
|
||||||
}
|
|
||||||
|
void progind_destroy()
|
||||||
void progind_cancel()
|
{
|
||||||
{
|
delete __indwin__p;
|
||||||
__indwin__p->cancel();
|
__indwin__p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool progind_iscancelled()
|
void timerind_create(long l, char* title, bool bar, bool cancel,
|
||||||
{
|
int divisions, int interval)
|
||||||
return __indwin__p->iscancelled();
|
{
|
||||||
}
|
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
||||||
|
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
||||||
bool progind_isfinished()
|
}
|
||||||
{
|
|
||||||
return __indwin__p->isfinished();
|
void timerind_cancel()
|
||||||
}
|
{
|
||||||
|
__indwin__p->cancel();
|
||||||
void progind_destroy()
|
}
|
||||||
{
|
|
||||||
delete __indwin__p;
|
bool timerind_iscancelled()
|
||||||
__indwin__p = NULL;
|
{
|
||||||
}
|
return __indwin__p->iscancelled();
|
||||||
|
}
|
||||||
void timerind_create(long l, char* title, bool bar, bool cancel,
|
|
||||||
int divisions, int interval)
|
bool timerind_isfinished()
|
||||||
{
|
{
|
||||||
CHECK(__indwin__p == NULL, "Cannot have more than one progress indicator");
|
return __indwin__p->isfinished();
|
||||||
__indwin__p = new TTimerind(l,title,bar,cancel,divisions,interval);
|
}
|
||||||
}
|
|
||||||
|
void timerind_destroy()
|
||||||
void timerind_cancel()
|
{
|
||||||
{
|
delete __indwin__p;
|
||||||
__indwin__p->cancel();
|
__indwin__p = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool timerind_iscancelled()
|
|
||||||
{
|
|
||||||
return __indwin__p->iscancelled();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool timerind_isfinished()
|
|
||||||
{
|
|
||||||
return __indwin__p->isfinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
void timerind_destroy()
|
|
||||||
{
|
|
||||||
delete __indwin__p;
|
|
||||||
__indwin__p = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
@ -1049,21 +1049,43 @@ TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
|
|||||||
}
|
}
|
||||||
if (n > 0)
|
if (n > 0)
|
||||||
add_tag_button(0, ca, _sel);
|
add_tag_button(0, ca, _sel);
|
||||||
|
|
||||||
|
TToken_string tids = head;
|
||||||
|
TToken_string tfns = fields;
|
||||||
|
TToken_string ids = f->browse()->get_input_fields();
|
||||||
|
TToken_string fns = f->browse()->get_input_field_names();
|
||||||
|
|
||||||
short y = 0;
|
short y = 0;
|
||||||
ca = f->browse()->get_input_fields();
|
for (const char* i = ids.get(0); i; i = ids.get())
|
||||||
for (const char* i = ca.get(0); i; i = ca.get())
|
|
||||||
{
|
{
|
||||||
if (*i != '"' && strchr(i, '@') == NULL)
|
if (*i != '"' && strchr(i, '@') == NULL)
|
||||||
{
|
{
|
||||||
const TMask_field& c = f->mask().field(f->atodlg(i));
|
const TMask_field& c = f->mask().field(f->atodlg(i));
|
||||||
if (c.is_editable() && c.active())
|
if (c.is_editable() && c.active())
|
||||||
{
|
{
|
||||||
|
int pos = ids.get_pos(c.dlg());
|
||||||
|
CHECK(pos >= 0, "Invalid input field");
|
||||||
|
TString80 p = fns.get(pos);
|
||||||
|
pos = tfns.get_pos(p);
|
||||||
|
if (pos >= 0)
|
||||||
|
{
|
||||||
|
p = tids.get(pos);
|
||||||
|
pos = p.find('@');
|
||||||
|
if (pos >= 0)
|
||||||
|
p.cut(pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
p.cut(0);
|
||||||
|
|
||||||
|
if (p.empty())
|
||||||
|
{
|
||||||
|
p = c.prompt();
|
||||||
|
// Toglie spazi e simboli iniziali dal prompt
|
||||||
|
for (int a = 0; p[a] && !isalnum(p[a]); a++);
|
||||||
|
p.ltrim(a);
|
||||||
|
}
|
||||||
|
p.left_just(16);
|
||||||
TEditable_field* e = NULL;
|
TEditable_field* e = NULL;
|
||||||
TString80 p = c.prompt();
|
|
||||||
// Toglie spazi e simboli iniziali dal prompt
|
|
||||||
for (int a = 0; p[a] && !isalnum(p[a]); a++);
|
|
||||||
p.ltrim(a); p.left_just(16);
|
|
||||||
switch (c.class_id())
|
switch (c.class_id())
|
||||||
{
|
{
|
||||||
case CLASS_EDIT_FIELD:
|
case CLASS_EDIT_FIELD:
|
||||||
|
2988
include/strings.cpp
2988
include/strings.cpp
File diff suppressed because it is too large
Load Diff
1160
include/strings.h
1160
include/strings.h
File diff suppressed because it is too large
Load Diff
Loading…
x
Reference in New Issue
Block a user