applicat.cpp Corretta gestione clessidra

msksheet.cpp   Corretta gestione set_focus_cell su celle disabilitate


git-svn-id: svn://10.65.10.50/trunk@2152 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-11-14 16:04:38 +00:00
parent 017ac5407f
commit 44778bb392
2 changed files with 29 additions and 17 deletions

View File

@ -643,15 +643,13 @@ bool TApplication::config()
}
void TApplication::set_cursor(bool w)
{
{
static int _count = 0;
WINDOW ww = cur_win();
if (ww == NULL_WIN) ww = TASK_WIN;
if (w)
{
if (_count == 0)
xvt_win_set_cursor(ww, CURSOR_WAIT);
xvt_win_set_cursor(TASK_WIN, CURSOR_WAIT);
_count++;
}
else
@ -659,7 +657,7 @@ void TApplication::set_cursor(bool w)
_count--;
CHECK(_count >= 0, "end_wait without matching begin_wait");
if (_count == 0)
xvt_win_set_cursor(ww, CURSOR_ARROW);
xvt_win_set_cursor(TASK_WIN, CURSOR_ARROW);
}
}

View File

@ -152,7 +152,9 @@ public:
// @cmember Ritorna l'array di tutte le stringhe delle righe
TString_array& rows_array()
{ return _str; }
// @cmember Trova una colonna abilitata a partire da colonna
int find_enabled_column(int rec, int colonna) const;
// @cmember Permette di mettere il focus su una cella
void set_focus_cell(int riga, int colonna);
// @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>)
@ -541,30 +543,42 @@ void TSpreadsheet::update_rec(int rec)
}
}
// Cerca una colonna abilitata a partire da colonna
// La prima cella utilizzabile ha indice 1
int TSpreadsheet::find_enabled_column(int rec, int colonna) const
{
if (colonna <= 0) colonna = 1;
const int last = _columns - 1;
for (int c = colonna-1; c < last; c++)
if (!cell_disabled(rec, c))
return c+1;
for (c = colonna-2; c >= 0; c--)
if (!cell_disabled(rec, c))
return c+1;
return 0;
}
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
xvt_scr_set_focus_vobj(win());
mask().set_focus_win(win(), FALSE);
const int r = row2rec(riga);
if (colonna <= 0) colonna = 1;
for (; colonna < _columns; colonna++)
if (!cell_disabled(r, colonna-1))
break;
if (colonna <= _columns)
const int rec = row2rec(riga);
colonna = find_enabled_column(rec, colonna);
if (colonna > 0)
{
XI_OBJ cell;
XI_MAKE_CELL(&cell, _list, riga, colonna);
xi_set_focus(&cell);
_edit_field = col2field(_cur_col = colonna);
if (r != _cur_rec)
if (rec != _cur_rec)
{
_cur_rec = r;
_cur_rec = rec;
_cur_row = riga;
str2mask(_cur_rec);
_row_dirty = FALSE;