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

View File

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

View File

@ -123,21 +123,14 @@ char *real::string (
// <p picture>. // <p picture>.
{ {
if (dec != UNDEFINED) TString16 fmt("%");
{ if (pad != ' ') fmt << '0';
if (len != 0) if (len != 0) fmt << len;
sprintf(__string, "%*.*Lf", len, dec, _dec); if (dec != UNDEFINED) fmt << '.' << dec;
else fmt << "Lf";
sprintf(__string, "%.*Lf", dec, _dec); sprintf(__string, fmt, _dec);
}
else
{
if (len != 0)
sprintf(__string, "%*Lf", len, _dec);
else
sprintf(__string, "%Lf", _dec);
if (strchr(__string, '.') != NULL) if (len == 0 && dec == UNDEFINED && strchr(__string, '.') != NULL)
{ {
int cut = strlen (__string); int cut = strlen (__string);
for (int i = cut-1; i >= 0; i--) for (int i = cut-1; i >= 0; i--)
@ -153,17 +146,6 @@ char *real::string (
} }
__string[cut] = '\0'; __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;
}
return __string; return __string;
} }