Patch level : 10.0 272
Files correlati : mg4.exe Ricompilazione Demo : [ ] Commento : Migliorata gestione righe di spreadsheet completamente disabilitate git-svn-id: svn://10.65.10.50/trunk@18621 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
e5c46ac873
commit
b50b89232f
@ -292,7 +292,7 @@ public:
|
||||
// @cmember Trova un record abilitato a partire da rec
|
||||
int find_enabled_record(int rec, int direction) const;
|
||||
// @cmember Permette di mettere il focus su una cella
|
||||
void set_focus_cell(int riga, int colonna);
|
||||
bool set_focus_cell(int riga, int colonna);
|
||||
// @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>)
|
||||
void activate(bool on);
|
||||
// @cmember Permette di abilitare/disabilitare una colonna
|
||||
@ -822,13 +822,15 @@ int TSpreadsheet::find_enabled_record(int rec, int direction) const
|
||||
}
|
||||
|
||||
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
|
||||
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||
bool TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||
{
|
||||
// xi_set_focus(get_interface());
|
||||
|
||||
const int rec = row2rec(riga);
|
||||
colonna = find_enabled_column(rec, colonna, +1);
|
||||
const int rec = row2rec(riga);
|
||||
if (rec < 0 || rec >= items())
|
||||
return false;
|
||||
|
||||
colonna = find_enabled_column(rec, colonna, +1);
|
||||
if (colonna > 0)
|
||||
{
|
||||
WINDOW win = xvt_scr_get_focus_vobj(); // Puo' essere NULL per cui poi non funziona ...
|
||||
@ -850,6 +852,8 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||
}
|
||||
_edit_field = col2field(_cur_col = colonna); // qui
|
||||
}
|
||||
|
||||
return colonna > 0;
|
||||
}
|
||||
|
||||
// @doc INTERNAL
|
||||
@ -986,16 +990,19 @@ void TSpreadsheet::update(
|
||||
|
||||
void TSpreadsheet::notify_change()
|
||||
{
|
||||
if (!_row_dirty)
|
||||
{
|
||||
str2mask(_cur_rec);
|
||||
_edit_field = cell2field(NULL); // Ricalcola correttamente il campo corrente
|
||||
|
||||
notify(_cur_rec, K_SPACE);
|
||||
xvtil_statbar_refresh();
|
||||
set_dirty();
|
||||
if (_cur_rec >= 0)
|
||||
{
|
||||
if (!_row_dirty)
|
||||
{
|
||||
str2mask(_cur_rec);
|
||||
_edit_field = cell2field(NULL); // Ricalcola correttamente il campo corrente
|
||||
|
||||
notify(_cur_rec, K_SPACE);
|
||||
xvtil_statbar_refresh();
|
||||
set_dirty();
|
||||
}
|
||||
_row_dirty = _cell_dirty = true; // Era tra le graffe
|
||||
}
|
||||
_row_dirty = _cell_dirty = true; // Era tra le graffe
|
||||
}
|
||||
|
||||
const char* TSpreadsheet::copy_cell2field(XI_OBJ* cell)
|
||||
@ -1101,6 +1108,11 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
{
|
||||
const long& rec = xiev->v.cell_request.rec;
|
||||
const short& maxlen = xiev->v.cell_request.len;
|
||||
if (rec < 0 || rec >= items() || maxlen <= 0) // Puo' succedere: strano ma vero!
|
||||
{
|
||||
refused = TRUE;
|
||||
return false;
|
||||
}
|
||||
|
||||
const char* src = NULL;
|
||||
int nm;
|
||||
@ -1336,7 +1348,13 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
||||
{
|
||||
// set_pos(xiev->v.xi_obj->v.cell.row, xiev->v.xi_obj->v.cell.column);
|
||||
const XI_CELL_DATA& cell = xiev->v.xi_obj->v.cell;
|
||||
set_focus_cell(cell.row, cell.column);
|
||||
const bool ok = set_focus_cell(cell.row, cell.column);
|
||||
if (!ok)
|
||||
{
|
||||
_check_enabled = TRUE;
|
||||
refused = TRUE;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (oldrec != _cur_rec || !_row_dirty)
|
||||
@ -3080,13 +3098,13 @@ void TSheet_field::post_select(int r)
|
||||
s->post_select(r);
|
||||
}
|
||||
|
||||
void TSheet_field::set_focus_cell(int riga, int colonna)
|
||||
bool TSheet_field::set_focus_cell(int riga, int colonna)
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
s->set_focus_cell(riga, colonna);
|
||||
return s->set_focus_cell(riga, colonna);
|
||||
}
|
||||
|
||||
void TSheet_field::set_focus_cell_id(long rec, short cid)
|
||||
bool TSheet_field::set_focus_cell_id(long rec, short cid)
|
||||
{
|
||||
TSpreadsheet* s = (TSpreadsheet*)_ctl;
|
||||
|
||||
@ -3098,10 +3116,12 @@ void TSheet_field::set_focus_cell_id(long rec, short cid)
|
||||
xi_get_visible_columns(s->_obj, &first_col, &last_col);
|
||||
xi_get_visible_rows(s->_obj, &first_row, &last_row);
|
||||
|
||||
bool ok = false;
|
||||
if (col >= first_col && col <= last_col && row >= first_row && row <= last_row)
|
||||
s->set_focus_cell(row, col);
|
||||
ok = s->set_focus_cell(row, col);
|
||||
else
|
||||
s->select(rec, col, true);
|
||||
return ok;
|
||||
}
|
||||
|
||||
bool TSheet_field::on_key(KEY k)
|
||||
|
@ -101,13 +101,13 @@ protected:
|
||||
// @cmember Ricopia i campi del record <p n>-esimo nella maschera
|
||||
virtual void row2mask(int n, TToken_string & rec, int mode = 0x3);
|
||||
// @cmember Permette di mettere il focus su una cella
|
||||
void set_focus_cell(int riga, int colonna);
|
||||
bool set_focus_cell(int riga, int colonna);
|
||||
|
||||
// @access Public Member
|
||||
public:
|
||||
|
||||
// @cmember Permette di mettere il focus su una cella
|
||||
void set_focus_cell_id(long rec, short cid);
|
||||
bool set_focus_cell_id(long rec, short cid);
|
||||
|
||||
// @cmember Gestisce la pressione del tasto (true se la gestione ha avuto successo)
|
||||
virtual bool on_key(KEY k);
|
||||
|
@ -195,7 +195,7 @@ protected:
|
||||
|
||||
// @cmember Richiede se il record corrente e' protetto (non cancellabile)
|
||||
virtual bool protected_record(TRectype&)
|
||||
{ return FALSE; }
|
||||
{ return false; }
|
||||
|
||||
// @cmember Richiede se il record corrente e' protetto (non cancellabile)
|
||||
virtual bool protected_record(TRelation &);
|
||||
|
Loading…
x
Reference in New Issue
Block a user