msksheet.cpp Corretta gestione focus

real.cpp      Corretta string con i long double


git-svn-id: svn://10.65.10.50/trunk@2057 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-10-31 14:01:20 +00:00
parent 28806b097d
commit 187fdac4fc
2 changed files with 43 additions and 58 deletions

@ -458,18 +458,18 @@ int TSpreadsheet::row2rec(int& row)
if (row < 0)
{
row = 0;
r = (int)rec[row]-1;
r = (int)rec[row] /* -1 */;
}
else
if (row >= rows)
{
row = rows-1;
r = (int)rec[row]+1;
r = (int)rec[row] /* +1 */;
}
else
r = (int)rec[row];
CHECKD(r >= 0 && r <= items(), "Sheet line out of range: ", row);
CHECKD(r >= 0 && r < items(), "Sheet line out of range: ", row);
return r;
}
@ -809,7 +809,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
{
notify_change();
_cell_dirty = TRUE;
_edit_field->set_focusdirty();
_edit_field->set_dirty();
}
break;
case XIE_BUTTON:
@ -1824,7 +1824,7 @@ void TSheet_field::highlight() const
{
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());
}
@ -1921,19 +1921,22 @@ bool TSheet_field::on_key(KEY k)
{
if (!test_focus_change())
return FALSE;
};
if (k == K_ROWEDIT )
}
if (k == K_TAB && !focusdirty() && items() > 0)
{
select(0);
}
if (k == K_ROWEDIT && items() > 0)
{
if ( items( ) )
{
_sheet->select( _sheet->items( ) - 1 );
XI_EVENT xie;
xie.type = XIE_DBL_CELL;
xie.v.xi_obj = NULL;
_sheet->list_handler( &xie );
return TRUE;
}
};
select(items()-1);
XI_EVENT xie;
xie.type = XIE_DBL_CELL;
xie.v.xi_obj = NULL;
_sheet->list_handler( &xie );
return TRUE;
}
return TMask_field::on_key(k);
}

@ -122,48 +122,30 @@ char *real::string (
// <nl>Nel secondo caso ritorna la stringa con il formato stabilito in
// <p picture>.
{
if (dec != UNDEFINED)
{
if (len != 0)
sprintf(__string, "%*.*Lf", len, dec, _dec);
else
sprintf(__string, "%.*Lf", dec, _dec);
}
else
{
if (len != 0)
sprintf(__string, "%*Lf", len, _dec);
else
sprintf(__string, "%Lf", _dec);
if (strchr(__string, '.') != NULL)
{
int cut = strlen (__string);
for (int i = cut-1; i >= 0; i--)
{
if (__string[i] == '0')
cut--;
else
{
if(__string[i] == '.')
cut--;
break;
}
}
__string[cut] = '\0';
}
}
const int lun = strlen (__string);
if (lun < len)
{
const int delta = len - lun;
for (int i = lun; i >= 0; i--)
__string[i + delta] = __string[i];
for (i = 0; i < delta; i++)
__string[i] = pad;
}
{
TString16 fmt("%");
if (pad != ' ') fmt << '0';
if (len != 0) fmt << len;
if (dec != UNDEFINED) fmt << '.' << dec;
fmt << "Lf";
sprintf(__string, fmt, _dec);
if (len == 0 && dec == UNDEFINED && strchr(__string, '.') != NULL)
{
int cut = strlen (__string);
for (int i = cut-1; i >= 0; i--)
{
if (__string[i] == '0')
cut--;
else
{
if(__string[i] == '.')
cut--;
break;
}
}
__string[cut] = '\0';
}
return __string;
}