Aggiunta della notifica dell'entrata in una riga con K_TAB

Corretto metodo highlight per gestire sheet vuoti


git-svn-id: svn://10.65.10.50/trunk@1679 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-08-04 12:21:02 +00:00
parent 30ea619d86
commit 7af71b88ec

View File

@ -488,24 +488,18 @@ bool TSpreadsheet::test_focus_change()
{ {
bool ok = dirty() != 3; bool ok = dirty() != 3;
if (ok && _row_dirty) if (ok && _row_dirty)
{
// str2mask(selected());
// ok = sheet_mask().check_fields();
ok = xi_move_focus(_itf) ? TRUE : FALSE; ok = xi_move_focus(_itf) ? TRUE : FALSE;
}
return ok; return ok;
} }
//void TSpreadsheet::xiev_handler(XI_OBJ *itf, XI_EVENT *xiev) HIDDEN void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
void XVT_CALLCONV1 xiev_handler(XI_OBJ *itf, XI_EVENT *xiev)
{ {
TSpreadsheet* es = (TSpreadsheet*)xi_get_app_data(itf); TSpreadsheet* es = (TSpreadsheet*)xi_get_app_data(itf);
CHECK(es, "NULL Edit sheet in xi event"); CHECK(es, "NULL Edit sheet in xi event");
es->list_handler(xiev); es->list_handler(xiev);
} }
// Certified 75% // Certified 75%
void TSpreadsheet::list_handler(XI_EVENT *xiev) void TSpreadsheet::list_handler(XI_EVENT *xiev)
{ {
@ -672,7 +666,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
if (_check_enabled) if (_check_enabled)
{ {
set_pos(xiev->v.xi_obj->v.row, _cur_col); set_pos(xiev->v.xi_obj->v.row, _cur_col);
if (_cur_rec < items()) if (_cur_rec < items() && notify(_cur_rec, K_TAB))
{ {
str2mask(_cur_rec); str2mask(_cur_rec);
_row_dirty = FALSE; _row_dirty = FALSE;
@ -990,14 +984,13 @@ bool TSpreadsheet::on_key(KEY k)
k = K_INS; // Inserimento in corso k = K_INS; // Inserimento in corso
} }
notify(n, K_TAB); // Notifica selezione
notify(n, K_SPACE); // Notifica inizio cambiamento notify(n, K_SPACE); // Notifica inizio cambiamento
k = edit(n, k); // Edita riga selezionata o creata k = edit(n, k); // Edita riga selezionata o creata
if (k == K_ENTER) if (k == K_ENTER)
notify(n, K_ENTER); // Notifica avvenuto cambiamento notify(n, K_ENTER); // Notifica avvenuto cambiamento
xvt_R3_set_front_window(win()); xvt_vobj_raise(win()); // Aggiorna sheet a video
/* xvt_scr_set_focus_vobj(win()); -- set_focus does not raise window */
/* xvt_vobj_raise(win()); -- note: raise is illegal on controls */ // Aggiorna sheet a video
open(); open();
} }
break; break;
@ -1124,9 +1117,10 @@ void TSpreadsheet::enable_column(int col, bool on)
{ {
int num; int num;
XI_OBJ** columns = xi_get_member_list(_list, &num); XI_OBJ** columns = xi_get_member_list(_list, &num);
CHECKD(col+1 < num, "Can't enable column ", col); for (int c = 1; c < num; c++)
XI_OBJ* column = columns[col+1]; if (columns[c]->cid == FIRST_FIELD+col)
{
XI_OBJ* column = columns[c];
dword attr = xi_get_attrib(column); dword attr = xi_get_attrib(column);
if (on) attr |= XI_ATR_ENABLED; if (on) attr |= XI_ATR_ENABLED;
else attr &= ~XI_ATR_ENABLED; else attr &= ~XI_ATR_ENABLED;
@ -1135,6 +1129,10 @@ void TSpreadsheet::enable_column(int col, bool on)
xi_set_attrib(column, attr); // Set new attributes xi_set_attrib(column, attr); // Set new attributes
RCT r; xi_get_rect(column, &r); RCT r; xi_get_rect(column, &r);
xi_set_column_width(column, (r.right-r.left+1) / CHARX); // Force redraw xi_set_column_width(column, (r.right-r.left+1) / CHARX); // Force redraw
break;
}
} }
#endif #endif
} }
@ -1463,11 +1461,14 @@ void TSheet_field::set_getmask(SPREADSHEET_GETMASK n)
_sheet->set_getmask( n ); _sheet->set_getmask( n );
} }
// Certified 50%
void TSheet_field::highlight() const void TSheet_field::highlight() const
{ {
TMask_field::highlight(); TMask_field::highlight();
#if XVT_OS == XVT_OS_WIN #if XVT_OS == XVT_OS_WIN
if (items()) int rows; xi_get_list_info(_sheet->_list, &rows);
if (rows > 0)
{ {
_sheet->_firstfocus = FALSE; _sheet->_firstfocus = FALSE;
if (_sheet->_edit_field == NULL) if (_sheet->_edit_field == NULL)