controls.cpp Aggiunte alcune righe di debug per tasti freccia
msksheet.cpp Corretta gestione tasti freccia relation.cpp Tolto il maiuscolo dai nomi dei TFieldref git-svn-id: svn://10.65.10.50/trunk@3522 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
8246fd8547
commit
9fd2d09c0b
@ -513,6 +513,10 @@ HIDDEN void xi_event_handler(XI_OBJ* itf, XI_EVENT* xiev)
|
|||||||
XI_OBJ* fo = xi_get_focus(itf);
|
XI_OBJ* fo = xi_get_focus(itf);
|
||||||
if (fo != NULL && fo->type == XIT_CELL)
|
if (fo != NULL && fo->type == XIT_CELL)
|
||||||
ctl = (TControl*)xi_get_app_data(fo->parent);
|
ctl = (TControl*)xi_get_app_data(fo->parent);
|
||||||
|
#ifdef DBG
|
||||||
|
if (xiev->v.xvte.v.chr.ch == K_DOWN || xiev->v.xvte.v.chr.ch == K_UP)
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -2380,12 +2380,14 @@ TRectype::TRectype(int logicnum) : _cod(NULL)
|
|||||||
}
|
}
|
||||||
_rec = new char [ _length ];
|
_rec = new char [ _length ];
|
||||||
*_tab = '\0';
|
*_tab = '\0';
|
||||||
if( lf_has_memo( _logicnum ) )
|
|
||||||
init_memo(RECORD_NON_FISICO );
|
|
||||||
if (_length)
|
if (_length)
|
||||||
zero();
|
zero();
|
||||||
else
|
else
|
||||||
setempty(TRUE);
|
setempty(TRUE);
|
||||||
|
|
||||||
|
if( lf_has_memo( _logicnum ) )
|
||||||
|
init_memo(RECORD_NON_FISICO );
|
||||||
}
|
}
|
||||||
|
|
||||||
TRectype::TRectype(const TBaseisamfile* i): _cod(NULL)
|
TRectype::TRectype(const TBaseisamfile* i): _cod(NULL)
|
||||||
@ -2405,12 +2407,14 @@ TRectype::TRectype(const TBaseisamfile* i): _cod(NULL)
|
|||||||
}
|
}
|
||||||
*_tab = '\0';
|
*_tab = '\0';
|
||||||
_rec = new char [ _length ];
|
_rec = new char [ _length ];
|
||||||
if( lf_has_memo( _logicnum ) )
|
|
||||||
init_memo(RECORD_NON_FISICO );
|
|
||||||
if (_length)
|
if (_length)
|
||||||
zero();
|
zero();
|
||||||
else
|
else
|
||||||
setempty(TRUE);
|
setempty(TRUE);
|
||||||
|
|
||||||
|
if( lf_has_memo( _logicnum ) )
|
||||||
|
init_memo(RECORD_NON_FISICO );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2897,7 +2901,7 @@ void TRectype::zero(const char* fieldname)
|
|||||||
if (CZeroField((char*) fieldname, rec_des(), _rec) == FIELDERR)
|
if (CZeroField((char*) fieldname, rec_des(), _rec) == FIELDERR)
|
||||||
unknown_field(fieldname);
|
unknown_field(fieldname);
|
||||||
}
|
}
|
||||||
if( lf_has_memo( _logicnum ) )
|
if (has_memo())
|
||||||
init_memo(RECORD_NON_FISICO );
|
init_memo(RECORD_NON_FISICO );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2910,8 +2914,8 @@ void TRectype::zero(char c)
|
|||||||
if (_cod != NULL)
|
if (_cod != NULL)
|
||||||
*_cod = _tab;
|
*_cod = _tab;
|
||||||
|
|
||||||
if( lf_has_memo( _logicnum ) )
|
if (has_memo())
|
||||||
init_memo( RECORD_NON_FISICO );
|
init_memo();
|
||||||
setempty(TRUE);
|
setempty(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2923,7 +2927,7 @@ TRectype& TRectype::operator =(const TRectype& rec)
|
|||||||
CHECK(num() == rec.num(), "Can't assign records of different file");
|
CHECK(num() == rec.num(), "Can't assign records of different file");
|
||||||
|
|
||||||
memcpy(_rec, rec._rec, _length); // Copy contents
|
memcpy(_rec, rec._rec, _length); // Copy contents
|
||||||
if (_memoinfo)
|
if (has_memo())
|
||||||
{
|
{
|
||||||
TTrec r;
|
TTrec r;
|
||||||
r.get(_logicnum);
|
r.get(_logicnum);
|
||||||
@ -3110,7 +3114,7 @@ HIDDEN void __putfieldbuff(byte l, byte d, byte t, const char* s, char* recout)
|
|||||||
if (recout == NULL) return;
|
if (recout == NULL) return;
|
||||||
|
|
||||||
char s2[256];
|
char s2[256];
|
||||||
strcpy(s2, s);
|
strcpy(s2, s); // We are the world, we are the children!
|
||||||
|
|
||||||
if (t == _datefld)
|
if (t == _datefld)
|
||||||
{
|
{
|
||||||
|
@ -1,3 +1,16 @@
|
|||||||
|
#define XI_INTERNAL
|
||||||
|
#include <xi.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <xiutils.h>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <colors.h>
|
#include <colors.h>
|
||||||
#include <controls.h>
|
#include <controls.h>
|
||||||
#include <keys.h>
|
#include <keys.h>
|
||||||
@ -570,7 +583,7 @@ int TSpreadsheet::find_enabled_record(int rec, int direction) const
|
|||||||
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
|
// riga (da 0), colonna (0 = numero, 1 = prima cella, ...)
|
||||||
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
||||||
{
|
{
|
||||||
// xi_set_focus(get_interface());
|
// xi_set_focus(get_interface());
|
||||||
|
|
||||||
const int rec = row2rec(riga);
|
const int rec = row2rec(riga);
|
||||||
colonna = find_enabled_column(rec, colonna, +1);
|
colonna = find_enabled_column(rec, colonna, +1);
|
||||||
@ -587,6 +600,7 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
|
|||||||
|
|
||||||
XI_OBJ cell;
|
XI_OBJ cell;
|
||||||
XI_MAKE_CELL(&cell, _obj, riga, colonna);
|
XI_MAKE_CELL(&cell, _obj, riga, colonna);
|
||||||
|
|
||||||
xi_set_focus(&cell);
|
xi_set_focus(&cell);
|
||||||
|
|
||||||
_edit_field = col2field(_cur_col = colonna);
|
_edit_field = col2field(_cur_col = colonna);
|
||||||
@ -710,8 +724,11 @@ void TSpreadsheet::update(
|
|||||||
|
|
||||||
if (scroll)
|
if (scroll)
|
||||||
xi_scroll(_obj, XI_SCROLL_FIRST);
|
xi_scroll(_obj, XI_SCROLL_FIRST);
|
||||||
else
|
else
|
||||||
xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
|
{
|
||||||
|
const long as = AUTOSELECT ? XI_ATR_AUTOSELECT : 0;
|
||||||
|
xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | as, 0);
|
||||||
|
}
|
||||||
|
|
||||||
_needs_update = -1; // Clear pending row update
|
_needs_update = -1; // Clear pending row update
|
||||||
}
|
}
|
||||||
@ -985,9 +1002,17 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
case XIE_ON_ROW:
|
case XIE_ON_ROW:
|
||||||
if (_check_enabled)
|
if (_check_enabled)
|
||||||
{
|
{
|
||||||
int row = xiev->v.xi_obj->v.row;
|
const int row = xiev->v.xi_obj->v.row; // Riga in cui si sta entrando
|
||||||
int next_rec = row2rec(row);
|
int rows; // Numero totale di righe attive
|
||||||
if (find_enabled_column(next_rec, 1, +1) <= 0)
|
const long* handle = xi_get_list_info(_obj, &rows);
|
||||||
|
|
||||||
|
// Calcola il numero del record corrispondente alla riga
|
||||||
|
const bool exist = row >= 0 && row < rows;
|
||||||
|
int next_rec = exist ? (int)handle[row] : items()-1;
|
||||||
|
|
||||||
|
// Se la riga non esiste o non ha nessuna cella valida abilitata ...
|
||||||
|
// ... cerca la prossima riga valida e rifiuta l'ingresso in questa
|
||||||
|
if (!exist || find_enabled_column(next_rec, 1, +1) <= 0)
|
||||||
{
|
{
|
||||||
next_rec = find_enabled_record(next_rec, next_rec >= _cur_rec ? +1 : -1);
|
next_rec = find_enabled_record(next_rec, next_rec >= _cur_rec ? +1 : -1);
|
||||||
post_select(next_rec);
|
post_select(next_rec);
|
||||||
@ -1059,6 +1084,10 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
_edit_field = f;
|
_edit_field = f;
|
||||||
_cur_col = physical_column;
|
_cur_col = physical_column;
|
||||||
_edit_field->set_focusdirty(_cell_dirty = FALSE);
|
_edit_field->set_focusdirty(_cell_dirty = FALSE);
|
||||||
|
|
||||||
|
// Azzera il flag di update_pending
|
||||||
|
EVENT e; e.type = E_UPDATE;
|
||||||
|
xi_eh(_obj->itf->v.itf->xvt_win, &e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -1094,7 +1123,6 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
copy_cell2field();
|
copy_cell2field();
|
||||||
}
|
}
|
||||||
case K_F2:
|
case K_F2:
|
||||||
case K_F3:
|
|
||||||
case K_F11:
|
case K_F11:
|
||||||
if (_check_enabled && active())
|
if (_check_enabled && active())
|
||||||
{
|
{
|
||||||
@ -1240,11 +1268,21 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
break;
|
break;
|
||||||
case K_ENTER:
|
case K_ENTER:
|
||||||
case K_SHIFT+K_ENTER:
|
case K_SHIFT+K_ENTER:
|
||||||
if (xi_move_focus(get_interface())) // Test di uscita dalla cella corrente
|
{
|
||||||
{
|
const int next_rec = find_enabled_record(_cur_rec, k == K_ENTER ? +1 : -1);
|
||||||
xi_set_focus(_obj); // Riporta il focus sullo sheet
|
if (next_rec >= 0)
|
||||||
dispatch_e_char(parent(), k == K_ENTER ? K_F3 : K_F4);
|
{
|
||||||
refused = TRUE;
|
dispatch_e_char(parent(), k == K_ENTER ? K_DOWN : K_UP);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// if (xi_move_focus(get_interface())) // Test di uscita dalla cella corrente
|
||||||
|
// {
|
||||||
|
// xi_set_focus(_obj); // Riporta il focus sullo sheet
|
||||||
|
dispatch_e_char(parent(), k == K_ENTER ? K_F3 : K_F4);
|
||||||
|
// }
|
||||||
|
refused = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case K_ESC:
|
case K_ESC:
|
||||||
@ -1332,7 +1370,10 @@ void TSpreadsheet::select(int rec, bool scrollto)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (scrollto)
|
if (scrollto)
|
||||||
xi_scroll_rec(_obj, rec, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0);
|
{
|
||||||
|
const long as = AUTOSELECT ? XI_ATR_AUTOSELECT : 0;
|
||||||
|
xi_scroll_rec(_obj, rec, NORMAL_COLOR, XI_ATR_ENABLED | as, 0);
|
||||||
|
}
|
||||||
|
|
||||||
const int row = rec2row(rec);
|
const int row = rec2row(rec);
|
||||||
const bool has_focus = mask().focus_field().dlg() == owner().dlg();
|
const bool has_focus = mask().focus_field().dlg() == owner().dlg();
|
||||||
|
@ -227,8 +227,12 @@ void TRelationdef::print_on(TToken_string& out) const
|
|||||||
const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to)
|
const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to)
|
||||||
{
|
{
|
||||||
TExpression& expr = (TExpression&)_exprs[j];
|
TExpression& expr = (TExpression&)_exprs[j];
|
||||||
|
TString16 name;
|
||||||
for (int k = 0; k < expr.numvar(); k++)
|
for (int k = 0; k < expr.numvar(); k++)
|
||||||
expr.setvar(k, to.get(expr.varname(k)));
|
{
|
||||||
|
name = expr.varname(k); name.upper();
|
||||||
|
expr.setvar(k, to.get(name));
|
||||||
|
}
|
||||||
|
|
||||||
const char* val = expr;
|
const char* val = expr;
|
||||||
|
|
||||||
@ -236,7 +240,10 @@ const char* TRelationdef::evaluate_expr(int j, const TLocalisamfile& to)
|
|||||||
{
|
{
|
||||||
TExpression& altexpr = (TExpression&)_altexprs[j];
|
TExpression& altexpr = (TExpression&)_altexprs[j];
|
||||||
for (int k = 0; k < expr.numvar(); k++)
|
for (int k = 0; k < expr.numvar(); k++)
|
||||||
altexpr.setvar(k, to.get(altexpr.varname(k)));
|
{
|
||||||
|
name = altexpr.varname(k); name.upper();
|
||||||
|
altexpr.setvar(k, to.get(name));
|
||||||
|
}
|
||||||
val = altexpr;
|
val = altexpr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -584,11 +591,6 @@ int TRelation::position_rels(
|
|||||||
{
|
{
|
||||||
for (int j = 0 ; j < rd._fields.items(); j++) // for each field
|
for (int j = 0 ; j < rd._fields.items(); j++) // for each field
|
||||||
{
|
{
|
||||||
/*
|
|
||||||
TExpression& expr = (TExpression&)rd._exprs[j];
|
|
||||||
for (int k = 0; k < expr.numvar(); k++)
|
|
||||||
expr.setvar(k, to.get(expr.varname(k)));
|
|
||||||
*/
|
|
||||||
const char* expr = rd.evaluate_expr(j, to);
|
const char* expr = rd.evaluate_expr(j, to);
|
||||||
TFieldref& s = (TFieldref&) rd._fields[j];
|
TFieldref& s = (TFieldref&) rd._fields[j];
|
||||||
s.write(expr, from.curr());
|
s.write(expr, from.curr());
|
||||||
@ -1688,7 +1690,6 @@ TFieldref& TFieldref::operator =(
|
|||||||
int par = s.find('[', pos); // Cerca la fine del nome del campo
|
int par = s.find('[', pos); // Cerca la fine del nome del campo
|
||||||
_name = s.sub(pos, par); // Estrae il nome del campo
|
_name = s.sub(pos, par); // Estrae il nome del campo
|
||||||
_name.strip(" "); // Elimina eventuali spazi superflui
|
_name.strip(" "); // Elimina eventuali spazi superflui
|
||||||
_name.upper(); // Converte in maiuscolo il nome del campo
|
|
||||||
|
|
||||||
if (par > 0)
|
if (par > 0)
|
||||||
{
|
{
|
||||||
@ -1737,12 +1738,13 @@ const char* TFieldref::read(const TRectype& rec) const
|
|||||||
if (_fileid >= CNF_GENERAL)
|
if (_fileid >= CNF_GENERAL)
|
||||||
{
|
{
|
||||||
TToken_string s(_name, '.');
|
TToken_string s(_name, '.');
|
||||||
TConfig c(_fileid - CNF_STUDIO, s.get());
|
TConfig c(_fileid - CNF_STUDIO, s.get(0));
|
||||||
buffer = c.get(s.get());
|
buffer = c.get(s.get());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer = rec.get(_name);
|
buffer = _name; buffer.upper();
|
||||||
|
buffer = rec.get(buffer);
|
||||||
if (_from > 0 || _to > 0)
|
if (_from > 0 || _to > 0)
|
||||||
{
|
{
|
||||||
const int l = buffer.len();
|
const int l = buffer.len();
|
||||||
@ -1777,7 +1779,9 @@ void TFieldref::write(const char* val, TRectype& rec) const
|
|||||||
rec.put(_name, campo);
|
rec.put(_name, campo);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
rec.put(_name, val);
|
rec.put(_name, val);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int TFieldref::len(TRectype &rec) const
|
int TFieldref::len(TRectype &rec) const
|
||||||
|
@ -512,7 +512,6 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
{
|
{
|
||||||
const bool on = checked(rec);
|
const bool on = checked(rec);
|
||||||
xiev->v.cell_request.icon_rid = on ? ICO_CHECK_ON : ICO_CHECK_OFF;
|
xiev->v.cell_request.icon_rid = on ? ICO_CHECK_ON : ICO_CHECK_OFF;
|
||||||
// if (on) src = "X"; // A volte visualizza la X!
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'M': // Set value for "roman" cell
|
case 'M': // Set value for "roman" cell
|
||||||
@ -539,8 +538,7 @@ bool TSheet_control::event_handler(XI_OBJ* itf, XI_EVENT *xiev)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
xiev->v.cell_request.color = NORMAL_COLOR;
|
xiev->v.cell_request.color = NORMAL_COLOR;
|
||||||
// src = format("%ld", rec+1);
|
// src = format("%ld", rec+1); // Niente piu' numeri di riga!
|
||||||
src = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char* dst = xiev->v.cell_request.s;
|
char* dst = xiev->v.cell_request.s;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user