Correzioni a errori da PR

git-svn-id: svn://10.65.10.50/trunk@2475 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1996-01-19 13:02:25 +00:00
parent dc9861b386
commit 5116c3f37e
2 changed files with 33 additions and 18 deletions

View File

@ -1205,7 +1205,10 @@ void TMask::set(
TMask_field& f = field(fld_id);
f.set(s);
if (hit && (f.active() || f.ghost()))
{
f.set_dirty();
f.on_hit();
}
}
void TMask::set(short fld_id, long n, bool hit)

View File

@ -273,7 +273,8 @@ TSpreadsheet::TSpreadsheet(
TSheet_field* o) // @parm Indica il campo della maschera che contiene lo spreadsheet
: _mask(maskname, maskno), _notify(NULL), _getmask( NULL ), _owner(o),
_cur_row(0), _cur_col(1), _cur_rec(0), _edit_field(NULL), _active(TRUE),
_row_dirty(FALSE), _check_enabled(TRUE), _firstfocus(TRUE),
_row_dirty(FALSE), _check_enabled(TRUE),
_firstfocus(FALSE),
_needs_update(-1)
{
const int NUMBER_WIDTH = 3;
@ -468,22 +469,16 @@ TMask& TSpreadsheet::sheet_mask() const
int TSpreadsheet::row2rec(int& row)
{
int rows;
const long* rec = xi_get_list_info(_list, &rows);
const long* handle = xi_get_list_info(_list, &rows);
int r = -1;
if (row < 0)
{
row = 0;
r = (int)rec[row] /* -1 */;
}
else
{
if (row >= rows)
{
row = rows-1;
r = (int)rec[row] /* +1 */;
}
else
r = (int)rec[row];
}
const int r = (int)handle[row];
CHECKD(r >= 0 && r < items(), "Sheet line out of range: ", row);
@ -722,15 +717,25 @@ void TSpreadsheet::update(
{
if (rec < 0)
{
_needs_update = -1; // Clear pending row update
xi_cell_request(_list); // Update cell values
int num;
const long* handles = xi_get_list_info(_list, &num);
if (num == 0 || !_owner->mask().is_running() || _cur_rec >= items())
int num = 0;
const long* handle = xi_get_list_info(_list, &num);
int first = 0, last = 0;
bool scroll = items() == 0 || !_owner->mask().is_running();
if (!scroll)
{
xi_get_visible_rows(_list, &first, &last);
scroll = items() < handle[first];
}
if (scroll)
xi_scroll(_list, XI_SCROLL_FIRST);
else
xi_scroll_rec(_list, *handles, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
xi_scroll_rec(_list, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
_needs_update = -1; // Clear pending row update
}
else
update_rec(rec);
@ -1218,11 +1223,18 @@ void TSpreadsheet::activate(bool on)
void TSpreadsheet::select(int rec, bool scrollto)
{
int first = 0, last = 0;
if (!scrollto)
{
int rows;
const long* handle = xi_get_list_info(_list, &rows);
int first = 0, last = 0;
xi_get_visible_rows(_list, &first, &last);
scrollto = rec < handle[first] || rec > handle[last];
}
if (scrollto || rec < first || rec > last)
if (scrollto)
xi_scroll_rec(_list, rec, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
const int row = rec2row(rec);