controls.cpp Selezionato core di default per disabilitati

mask.h         Aggiuntop metodo protetto get_fields_array
maskfld.cpp    Trimmate le get dei list_field
maskfld.h      Aggiunto uno schifosissimo friend TSheet
sheet.cpp      Corretto problema del tasto freccia premuto all'inizio


git-svn-id: svn://10.65.10.50/trunk@2986 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-06-11 15:53:58 +00:00
parent f1f2ea8d51
commit 6a67a68b58
5 changed files with 57 additions and 18 deletions

View File

@ -140,13 +140,18 @@ enum event_action { a_ignore, a_xvt, a_xvt_post, a_obj, a_child, a_update, a_sel
void init_controls() void init_controls()
{ {
xi_set_font_id(xvt_default_font()); xi_set_font_id(xvt_default_font());
xi_set_pref(XI_PREF_NATIVE_CTRLS, FALSE); xi_set_pref(XI_PREF_NATIVE_CTRLS, FALSE);
xi_set_pref(XI_PREF_AUTOSEL_ON_MOUSE, TRUE);
xi_set_pref(XI_PREF_CARET_WIDTH, 2);
xi_set_pref(XI_PREF_3D_LOOK, TRUE); xi_set_pref(XI_PREF_3D_LOOK, TRUE);
xi_set_pref(XI_PREF_COLOR_LIGHT, MASK_LIGHT_COLOR); xi_set_pref(XI_PREF_COLOR_LIGHT, MASK_LIGHT_COLOR);
xi_set_pref(XI_PREF_COLOR_CTRL, MASK_BACK_COLOR); xi_set_pref(XI_PREF_COLOR_CTRL, MASK_BACK_COLOR);
xi_set_pref(XI_PREF_COLOR_DARK, MASK_DARK_COLOR); xi_set_pref(XI_PREF_COLOR_DARK, MASK_DARK_COLOR);
xi_set_pref(XI_PREF_COLOR_DISABLED, DISABLED_COLOR);
xi_set_pref(XI_PREF_AUTOSEL_ON_MOUSE, TRUE);
xi_set_pref(XI_PREF_CARET_WIDTH, 2);
xi_init(); xi_init();
event_map[XIE_CHAR_FIELD] = a_obj; event_map[XIE_CHAR_FIELD] = a_obj;

View File

@ -104,6 +104,7 @@ class TMask : public TWindow
// @access Protected Member // @access Protected Member
protected: protected:
TArray& fields_array() { return _field; }
// @cmember:(INTERNAL) Numero di sheet contenuti nella maschera // @cmember:(INTERNAL) Numero di sheet contenuti nella maschera
int _sheets; int _sheets;

View File

@ -3642,8 +3642,7 @@ int TList_field::str2curr(const char* data)
if (_flags.uppercase) if (_flags.uppercase)
str.upper(); str.upper();
int i = str.not_empty() ? _codes.get_pos(str) : 0; int i = str.blank() ? 0 : _codes.get_pos(str);
if (i < 0) // Se non trova il codice ritenta dopo trim if (i < 0) // Se non trova il codice ritenta dopo trim
{ {
for (i = 0; str[i] == '0' || str[i] == ' '; i++); for (i = 0; str[i] == '0' || str[i] == ' '; i++);
@ -3689,6 +3688,7 @@ void TList_field::current(int n)
{ {
((TListbox_control*)_ctl)->select(n); ((TListbox_control*)_ctl)->select(n);
_str = _codes.get(n); _str = _codes.get(n);
_str.trim();
} }
int TList_field::current() const int TList_field::current() const
@ -3700,6 +3700,7 @@ TString& TList_field::get_window_data()
{ {
const int c = current(); const int c = current();
_str = ((TList_field*)this)->_codes.get(c); _str = ((TList_field*)this)->_codes.get(c);
_str.trim();
return _str; return _str;
} }
@ -3786,6 +3787,7 @@ void TRadio_field::current(int n)
{ {
((TRadiobutton_control*)_ctl)->check_button(n); ((TRadiobutton_control*)_ctl)->check_button(n);
_str = _codes.get(n); _str = _codes.get(n);
_str.trim();
} }

View File

@ -58,6 +58,8 @@ class TMask_field : public TObject
{ {
// @cfriend TMask // @cfriend TMask
friend class TMask; friend class TMask;
// @cfriend TSheet
friend class TSheet;
// @access:(INTERNAL) Private Member // @access:(INTERNAL) Private Member

View File

@ -70,7 +70,7 @@ public:
void update(long n = -1); void update(long n = -1);
TSheet_control(TSheet* sheet, short cid, TSheet_control(WINDOW sheet, short cid,
short x, short y, short dx, short dy, short x, short y, short dx, short dy,
const char* flags, const char* head); const char* flags, const char* head);
virtual ~TSheet_control() {} virtual ~TSheet_control() {}
@ -78,7 +78,7 @@ public:
TSheet_control::TSheet_control( TSheet_control::TSheet_control(
TSheet* sheet, // @parm Finestra alla quale appartiene lo spreadsheet WINDOW parent, // @parm Finestra alla quale appartiene lo spreadsheet
short cid, // @parm Identificatore short cid, // @parm Identificatore
short x, // @parm Coordinata x (in caratteri) nel quale posizionare lo spreadsheet short x, // @parm Coordinata x (in caratteri) nel quale posizionare lo spreadsheet
short y, // @parm Coordinata y (in caratteri) nel quale posizionare lo spreadsheet short y, // @parm Coordinata y (in caratteri) nel quale posizionare lo spreadsheet
@ -86,7 +86,7 @@ TSheet_control::TSheet_control(
short dy, // @parm Lunghezza (in caratteri) dello spreasheet short dy, // @parm Lunghezza (in caratteri) dello spreasheet
const char* flags, // @parm Flags di abilitazione const char* flags, // @parm Flags di abilitazione
const char* head) // @parm Titolo delle colonne const char* head) // @parm Titolo delle colonne
: _sheet(sheet), _cur_rec(0), _check_enabled(FALSE) : _sheet(NULL), _cur_rec(0), _check_enabled(FALSE)
{ {
const int NUMBER_WIDTH = 7; const int NUMBER_WIDTH = 7;
@ -94,6 +94,8 @@ TSheet_control::TSheet_control(
short m_width[MAX_COL]; short m_width[MAX_COL];
int fixed_columns = 1; // Number of fixed columns int fixed_columns = 1; // Number of fixed columns
_sheet = (TSheet*)xvt_vobj_get_data(parent);
// Calcolo larghezza massima tabella // Calcolo larghezza massima tabella
TToken_string header(head); TToken_string header(head);
@ -147,8 +149,6 @@ TSheet_control::TSheet_control(
} }
const int _columns = i; const int _columns = i;
WINDOW parent = sheet->win();
// Calcola rettangolo massimo per lo sheet // Calcola rettangolo massimo per lo sheet
XI_RCT rct; coord2rct(parent, x, y, dx, dy, rct); XI_RCT rct; coord2rct(parent, x, y, dx, dy, rct);
rct.right -= 2*XI_FU_MULTIPLE; // toglie scroll-bar rct.right -= 2*XI_FU_MULTIPLE; // toglie scroll-bar
@ -528,6 +528,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
} }
else else
{ {
xiev->v.cell_request.color = NORMAL_COLOR;
src = format("%ld", rec+1); src = format("%ld", rec+1);
} }
@ -665,6 +666,31 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
return !refused; return !refused;
} }
///////////////////////////////////////////////////////////
// TQuery_field
///////////////////////////////////////////////////////////
class TQuery_field : public TOperable_field
{
protected:
virtual void create(WINDOW parent);
public:
TSheet_control* sheet() const { return (TSheet_control*)_ctl; }
TQuery_field(TMask* m) : TOperable_field(m) { }
virtual ~TQuery_field() { }
};
void TQuery_field::create(WINDOW parent)
{
_ctl = new TSheet_control(parent, dlg(),
_ctl_data._x, _ctl_data._y,
_ctl_data._width, _ctl_data._size,
_ctl_data._flags, _ctl_data._prompt);
}
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
// TSheet // TSheet
/////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////
@ -675,7 +701,10 @@ TSheet::TSheet(short x, short y, short dx, short dy,
: TMask(title, sht_y == 0 ? 1 : 2, dx, dy, x, y), : TMask(title, sht_y == 0 ? 1 : 2, dx, dy, x, y),
_parked(-1), _sheet(NULL), _select_row(-1) _parked(-1), _sheet(NULL), _select_row(-1)
{ {
_sheet = new TSheet_control(this, 883, 1, sht_y, -1, -3, "", head); TQuery_field* qf = new TQuery_field(this);
qf->construct(883, head, 1, sht_y, -3, win(), "", -1);
fields_array().add(qf);
_sheet = qf->sheet();
if (!(buttons & 0x10)) add_button(DLG_SELECT, "Selezione", K_ENTER); if (!(buttons & 0x10)) add_button(DLG_SELECT, "Selezione", K_ENTER);
if (check_enabled()) if (check_enabled())
@ -831,10 +860,10 @@ bool TSheet::on_key(KEY key)
case K_SPACE: case K_SPACE:
check(selected(), !checked(selected())); check(selected(), !checked(selected()));
break; break;
case K_F2: case K_F7:
uncheck(-1); uncheck(-1);
break; break;
case K_F3: case K_F8:
check(-1); check(-1);
break; break;
default: default:
@ -868,8 +897,7 @@ void TSheet::on_idle()
if (_select_row >= 0) if (_select_row >= 0)
{ {
const short focus_id = get_focus_id(win()); const short focus_id = get_focus_id(win());
if (focus_id == _sheet->id())
if (focus_id == 883)
{ {
_sheet->select(_select_row); _sheet->select(_select_row);
_sheet->set_focus_rec(-1); _sheet->set_focus_rec(-1);
@ -1029,7 +1057,8 @@ bool TBrowse_sheet::browse_field_handler(TMask_field& f, KEY k)
if (f.is_edit()) if (f.is_edit())
{ {
TEdit_field& ef = (TEdit_field&)f; TEdit_field& ef = (TEdit_field&)f;
c.set(ef.get_window_data()); const TString& wd = ef.get_window_data();
c.set(wd);
} }
else else
c.set(f.get()); c.set(f.get());