Migliorato meccanismo di ricerca

Errore MI4322


git-svn-id: svn://10.65.10.50/trunk@3588 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1996-09-16 08:25:10 +00:00
parent 1f310d596b
commit 5a1b819321
2 changed files with 70 additions and 3 deletions

View File

@ -42,6 +42,7 @@ protected:
long row2rec(int row) const;
void make_current(long rec);
XI_OBJ* find_column(int col) const;
public: // TControl
virtual void set_rect(const RCT& r);
@ -51,7 +52,7 @@ public:
void select(long n);
void set_focus_rec(long rec);
void enable_check(bool on) { _check_enabled = on && _type[0] == 'C'; }
void enable_check(bool on);
bool check_enabled() const { return _check_enabled; }
void check(long n, bool on);
void toggle(long n);
@ -366,6 +367,45 @@ void TSheet_control::set_focus_rec(long rec)
const int c = _type[0] == 'C' ? 2 : 1;
XI_OBJ cell; XI_MAKE_CELL(&cell, _obj, r, c);
xi_set_focus(&cell);
}
XI_OBJ* TSheet_control::find_column(
int col) const // @parm Indice o identificatore colonna
{
CHECKD(col >= 0, "Bad column ", col);
if (col < FIRST_FIELD) // Se e' un indice trasformalo in identificatore
col += FIRST_FIELD + 1000;
int num;
XI_OBJ** columns = xi_get_member_list(_obj, &num);
for (int c = num-1; c > 0; c--)
{
if (columns[c]->cid == col)
break;
}
if (c <= 0)
{
yesnofatal_box("Can't find column with id=%d", col);
c = 1;
}
return columns[c];
}
void TSheet_control::enable_check(bool on)
{
_check_enabled = on && _type[0] == 'C';
if (_type[0] == 'C')
{
XI_OBJ* column = find_column(1101);
dword attr = xi_get_attrib(column);
if (_check_enabled) attr |= XI_ATR_ENABLED;
else attr &= ~XI_ATR_ENABLED;
xi_set_attrib(column, attr); // Set new attributes
}
}
bool TSheet_control::one_checked() const
@ -461,7 +501,8 @@ void TSheet_control::enable_row(
}
update(n);
}
HIDDEN long _rec_to_select = -1;
// Certified 75%
bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
{
@ -580,8 +621,12 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
}
}
else
{
if (_sheet->_select_row < 0)
make_current(rec);
else
_rec_to_select = rec;
}
}
break;
case XIE_GET_PERCENT:
@ -1128,6 +1173,26 @@ bool TBrowse_sheet::last_browse_field_handler(TMask_field& f, KEY k)
return ok;
}
// @doc EXTERNAL
// @mfunc Gestisce l'handler della finestra
void TBrowse_sheet::handler(
WINDOW win, // @parm Finestra da gestire
EVENT* ep) // @parm Evento da gestire nella finestra
{
if (ep->type == E_MOUSE_DOWN)
{
TMask_field & f = fld(0);
RCT r; f.get_rect(r);
if (xvt_rect_has_point(&r, ep->v.mouse.where) && _rec_to_select >= 0)
{
post_select(_rec_to_select);
_rec_to_select = -1;
}
}
TCursor_sheet::handler(win, ep);
}
TBrowse_sheet::TBrowse_sheet(TCursor* cursor, const char* fields,
const char* title, const char* head, byte buttons,

View File

@ -214,12 +214,14 @@ class TBrowse_sheet : public TCursor_sheet
// @cmember:(INTERNAL) Campo di ricerca attuale (Tag button selezionato)
int _sel;
long _select_row;
// long _select_row;
// @access Protected Member
protected:
// @cmember Gestisce la pressione del tasto (vedi <mf TWindow::on_key>)
virtual bool on_key(KEY k);
// @cmember Gestisce gli eventi della finestra
virtual void handler(WINDOW win, EVENT* ep);
// @cmember Ritorna il campo a cui si riferisce lo sheet
TEdit_field& field()