diff --git a/include/msksheet.cpp b/include/msksheet.cpp
index fe14c5abb..a7765df6d 100755
--- a/include/msksheet.cpp
+++ b/include/msksheet.cpp
@@ -135,7 +135,7 @@ public:
// @cmember Ritorna il contenuto della riga
-esima
TToken_string& row(int n)
{ return _str.row(n); }
- // @cmember Aggiunge una riga allo spreadsheet passata come putatore
+ // @cmember Aggiunge una riga allo spreadsheet passata come puntatore
// (vedi )
int add(const TToken_string& s)
{ return _str.add(s); }
@@ -893,7 +893,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
if (_firstfocus) // Trick to avoid the sheet to keep the focus forever ...
{ // .. it costed me two day worth of hard work!
xiev->refused = TRUE;
- _firstfocus = FALSE;
+ _firstfocus = FALSE;
}
else
mask().set_focus_win(win(), FALSE);
@@ -1820,13 +1820,15 @@ void TSheet_field::highlight() const
{
TMask_field::highlight();
#if XVT_OS == XVT_OS_WIN
- int rows; xi_get_list_info(_sheet->_list, &rows);
- if (rows > 0)
- {
- _sheet->_firstfocus = FALSE;
- _sheet->set_focus_cell(_sheet->rec2row(selected()), 1);
- _sheet->str2mask(selected());
- }
+ if (_sheet->_check_enabled)
+ {
+ int rows; xi_get_list_info(_sheet->_list, &rows);
+ if (rows > 0)
+ {
+ _sheet->set_focus_cell(_sheet->_cur_row, _sheet->_cur_col);
+ _sheet->str2mask(selected());
+ }
+ }
#endif
}
diff --git a/include/sheet.cpp b/include/sheet.cpp
index e1a63d944..5670528ad 100755
--- a/include/sheet.cpp
+++ b/include/sheet.cpp
@@ -455,13 +455,13 @@ void TSheet::check(
int TSheet::row_to_page(long n) const
{
long i = (n < 0) ? 0L : n-first()+1;
-
+#ifdef DBG
if (i < 0 || i > visible_rows())
{
- error_box("Line out of screen");
- i = 0L;
+ yesnofatal_box("Line out of screen: %ld", n);
+ i = 1;
}
-
+#endif
return (int)i;
}
@@ -581,12 +581,15 @@ TToken_string& TSheet::row(
// selezionata.
{
if (n < 0) n = selected();
- if (!is_visible(n))
+
+ if (!is_visible(n) || _last_update < 0)
{
- build_page(n);
+ if (_last_update < 0)
+ set_scroll_max(width(), items());
+ build_page(n);
set_first(n);
}
- short idx = row_to_page(n);
+ const int idx = row_to_page(n);
return (TToken_string&)_page[idx];
}