form.h Resi pubblici alcuni metodi const dei form_item

isam.cpp     Corretta remove dei memofield
msksheet.cpp Corretta set_focus_cell
pagsca.h     Eliminato campo DATAPAG
partite.h    Aggiunto campo DATAPAG
sheet.cpp    Correta row(long r) a sheet "spento"


git-svn-id: svn://10.65.10.50/trunk@2221 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-12-01 11:49:11 +00:00
parent 9885f6d317
commit dd53428762
6 changed files with 61 additions and 43 deletions

View File

@ -254,12 +254,6 @@ protected:
virtual void print_on(ostream& out) const;
virtual void print_body(ostream& out) const;
bool shown() const { return _flag.shown; }
bool hidden() const { return !_flag.shown; }
bool enabled() const { return _flag.enabled; }
bool disabled() const { return !_flag.enabled; }
bool automagic() const { return _flag.automagic; }
virtual bool parse_head(TScanner&);
virtual bool parse_item(TScanner&);
@ -277,6 +271,12 @@ public:
virtual short& x() { return _x; }
virtual short& y() { return _y; }
bool shown() const { return _flag.shown; }
bool hidden() const { return !_flag.shown; }
bool enabled() const { return _flag.enabled; }
bool disabled() const { return !_flag.enabled; }
bool automagic() const { return _flag.automagic; }
virtual bool parse(TScanner&);
virtual bool update();
@ -290,6 +290,7 @@ public:
virtual const char* get() const { return _prompt; }
virtual bool set(const char* s) { _prompt = s; return TRUE; }
const char* prompt() const { return _prompt; }
TPrint_section& section() const { return *_section; }
TForm& form() const { return _section->form(); }

View File

@ -718,9 +718,9 @@ int TBaseisamfile::next(word lockop)
}
else
{
_lasterr=cisread(_isamfile, curr(), _isnext + lockop);
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
}
_lasterr=cisread(_isamfile, curr(), _isnext + lockop);
if (_lasterr != NOERR) _lasterr = get_error(_lasterr);
}
_recno = _isamfile->RecNo;
if( has_memo( ) )
{
@ -1096,14 +1096,15 @@ int TBaseisamfile::remove(TDate& atdate)
}
}
}
if(has_memo())
curr().memo_info().recno(RECORD_NON_FISICO);
_recno = _isamfile->RecNo = DB_recno(_isamfile->fhnd);
curr( ).memo_info( ).recno( RECORD_NON_FISICO );
return _lasterr;
}
int TBaseisamfile::remove(const TRectype& rec, TDate& atdate)
{
CHECK(!rec.empty(), "Can't remove an empty record");
@ -1124,14 +1125,16 @@ int TBaseisamfile::remove(const TRectype& rec, TDate& atdate)
}
}
}
curr( ).memo_info( ).recno( RECORD_NON_FISICO );
if(has_memo())
curr().memo_info().recno(RECORD_NON_FISICO);
_recno = _isamfile->RecNo = DB_recno(_isamfile->fhnd);
return _lasterr;
}
int TBaseisamfile::lock()
{
NOT_OPEN();
_lasterr = DB_lockfile(_isamfile->fhnd);

View File

@ -154,7 +154,7 @@ public:
{ return _str; }
// @cmember Trova una colonna abilitata a partire da colonna
int find_enabled_column(int rec, int colonna) const;
int find_enabled_column(int rec, int colonna, int direction) const;
// @cmember Permette di mettere il focus su una cella
void set_focus_cell(int riga, int colonna);
// @cmember Abilita/disabilita tutto lo spreadsheet (vedi <mf TMask::activate>)
@ -545,31 +545,38 @@ void TSpreadsheet::update_rec(int rec)
// Cerca una colonna abilitata a partire da colonna
// La prima cella utilizzabile ha indice 1
int TSpreadsheet::find_enabled_column(int rec, int colonna) const
{
const int last = _columns - 1;
int TSpreadsheet::find_enabled_column(int rec, int colonna, int direction) const
{
CHECKD(direction == +1 || direction == -1, "Bad column search direction", direction);
const int last = _columns - 1;
if (colonna <= 0 || colonna > last)
colonna = 1;
for (int c = colonna-1; c < last; c++)
if (!cell_disabled(rec, c))
return c+1;
if (!cell_disabled(rec, colonna-1))
return colonna;
for (c = colonna-2; c >= 0; c--)
if (!cell_disabled(rec, c))
return c+1;
for (int c = colonna+direction ; c != colonna; c += direction)
{
if (c > last)
c = 1;
else
if (c < 1) c = last;
if (!cell_disabled(rec, c-1))
return c;
}
return 0;
}
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
xvt_scr_set_focus_vobj(win());
mask().set_focus_win(win(), FALSE);
const int rec = row2rec(riga);
colonna = find_enabled_column(rec, colonna);
colonna = find_enabled_column(rec, colonna, +1);
if (colonna > 0)
{
@ -680,6 +687,7 @@ void TSpreadsheet::update(
{
if (row < 0)
{
_needs_update = -1; // Clear pending row update
xi_cell_request(_list); // Force updatde
xi_scroll(_list, XI_SCROLL_FIRST);
}
@ -972,11 +980,13 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
TMask_field* f = cell2field(xiev->v.xi_obj);
const int col = (f->dlg()-FIRST_FIELD) % 100;
if (cell_disabled(_cur_rec, col)) // If the cell is disabled ...
{
if (!cell_disabled(_cur_rec, -1)) // If the row is not disabled ...
{
dispatch_e_char(win(), _lastab); // ... skip to the next one.
_edit_field = NULL;
{
const int dir = _lastab == K_TAB ? +1 : -1;
const int nex = find_enabled_column(_cur_rec, col+1, dir);
if (nex > 0) // If at least one enabled cell exists
{
// _edit_field = NULL;
set_focus_cell(_cur_row, nex);
}
else
xiev->refused = TRUE;
@ -984,7 +994,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
else
{
_edit_field = f;
_cur_col = xiev->v.xi_obj->v.cell.column;
_cur_col = col+1;
_edit_field->set_focusdirty(_cell_dirty = FALSE);
}
}
@ -1043,7 +1053,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
break;
case K_UP:
case K_DOWN:
_lastab = _cur_col < 2 ? K_TAB : K_BTAB;
_lastab = (_cur_col == 2) ? K_BTAB : K_TAB;
break;
case K_F1:
case K_SHIFT+K_F1:
@ -1332,13 +1342,13 @@ void TSpreadsheet::mask2str(int rec)
break;
}
}
#ifdef DBG
if (pos < 0)
{
yesnofatal_box("Non e' visibile il campo %d per lo sheet", dlg);
#ifdef DBG
yesnofatal_box("Mask2str: Non e' visibile il campo %d", dlg);
#endif
r.add(" ");
}
#endif
}
#if XVT_OS == XVT_OS_WIN
if (_needs_update != rec)
@ -1566,7 +1576,7 @@ bool TSpreadsheet::cell_disabled(int row, int column) const
TBit_array* ba = (TBit_array*)_disabled.objptr(row);
bool d;
if (column < 0)
d = ba == NULL ? FALSE : (ba->ones() == columns()-1);
d = ba == NULL ? FALSE : (ba->ones() >= columns()-1);
else
d = ba == NULL ? _column_disabled[column] : (*ba)[column];

View File

@ -12,7 +12,6 @@
#define PAGSCA_ABBUONI "ABBUONI"
#define PAGSCA_PASSATT "PASSATT"
#define PAGSCA_DIFFCAM "DIFFCAM"
#define PAGSCA_DATAPAG "DATAPAG"
#define PAGSCA_CODABI "CODABI"
#define PAGSCA_CODCAB "CODCAB"

View File

@ -14,6 +14,7 @@
#define PART_NUMRIG "NUMRIG"
#define PART_DATAREG "DATAREG"
#define PART_DATADOC "DATADOC"
#define PART_DATAPAG "DATAPAG"
#define PART_NUMDOC "NUMDOC"
#define PART_DESCR "DESCR"
#define PART_REG "REG"

View File

@ -581,15 +581,19 @@ TToken_string& TSheet::row(
// selezionata.
{
if (n < 0) n = selected();
if (!is_visible(n) || _last_update < 0)
int idx = 1;
// if (!is_visible(n) || _last_update < 0)
if (_last_update < 0 || n < _last_update || n >= _last_update + _page.items() -1)
{
if (_last_update < 0)
set_scroll_max(width(), items());
// if (_last_update < 0)
// set_scroll_max(width(), items());
build_page(n);
set_first(n);
// set_first(n);
}
const int idx = row_to_page(n);
else
idx = int(n - _last_update) + 1;
// const int idx = row_to_page(n);
return (TToken_string&)_page[idx];
}