Abbassati i campi testo di un paio di pixel

Corretta la gestione dei buttoni negli sheet


git-svn-id: svn://10.65.10.50/trunk@762 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-12-14 14:33:46 +00:00
parent 325d8b66e3
commit ce2ef3bb20
6 changed files with 73 additions and 54 deletions

View File

@ -528,7 +528,7 @@ void TApplication::about() const
{
#include <prassi.ver>
const TFilename n(__argv[0]);
message_box("PRASSI Versione Beta %4.2f\nProgramma %s\nLibreria del %s",
message_box("PRASSI Versione %4.2f\nProgramma %s\nLibreria del %s",
VERSION, (const char*)n.name(), __DATE__);
}
@ -595,17 +595,20 @@ const char* TApplication::get_firm_dir() const
bool TApplication::set_firm(long newfirm)
{
disable_menu_item(M_FILE_NEW);
const long oldfirm = get_firm();
if (newfirm < 1)
{
TMask mask("bagn002");
TString80 pp(__ptprf); pp.cut(pp.len()-1);
mask.set(F_PATHPREF, pp);
mask.send_key(K_CTRL+K_SHIFT+(extended_firm() ? 's' : 'h'), -2);
mask.show(-2, extended_firm());
disable_menu_item(M_FILE_NEW);
const KEY k = mask.run();
enable_menu_item(M_FILE_NEW);
if (k == K_ENTER)
{
newfirm = mask.get_long(F_CODDITTA);

View File

@ -1,3 +1,4 @@
#define F_CODDITTA 101
#define F_RAGSOC 102
#define F_TIPO 103
#define F_TIPO 103
#define F_PATHPREF 104

View File

@ -2,9 +2,15 @@
PAGE "Selezione Ditta" -1 -1 64 7
STRING F_PATHPREF 50
BEGIN
PROMPT 1 1 "Dati in "
FLAGS "D"
END
NUMBER F_CODDITTA 5
BEGIN
PROMPT 1 1 "Codice "
PROMPT 1 2 "Codice "
HELP "Codice della ditta da attivare"
FLAGS "FR"
USE LF_NDITTE KEY 1
@ -22,7 +28,7 @@ END
LIST F_TIPO 20
BEGIN
PROMPT 40 1 ""
PROMPT 40 2 ""
HELP "Tipo di dati da selezionare"
ITEM "0|Ditte"
MESSAGE ENABLE,1@

View File

@ -330,10 +330,10 @@ public:
};
TText::TText(short left, short top, short right, short bottom,
const char* caption, WINDOW parent,
const char* caption, WINDOW parent,
long flags, long app_data, short id)
{
create(left, top, right, bottom, caption, parent, flags, app_data, id);
create(left, top+1, right, bottom-1, caption, parent, flags, app_data, id);
}
void TText::update() const

View File

@ -43,7 +43,7 @@ class TSpreadsheet : public TWindow
TSheet_field* _owner; // Owner
TMask_field* _edit_field; // Current edit field
int _cur_row, _cur_col; // Current cell
int _cur_row, _cur_rec, _cur_col; // Current cell
bool _row_dirty; // Current row changed
bool _check_enabled; // Perform OFF_ROW checks
@ -62,8 +62,10 @@ protected:
int rec2row(int rec);
int row2rec(int row);
int set_pos(int row, int col) { _cur_col = col; return _cur_rec = row2rec(_cur_row = row); }
bool notify(int r, KEY k);
bool notify(int row, KEY k);
void notify_change();
public:
void update(int row);
@ -88,7 +90,7 @@ public:
KEY edit(int n);
int items() const { return _str.items(); }
int selected() const { return _cur_row; }
int selected() const { return _cur_rec; }
int columns() const { return _columns; }
bool dirty() const { return _owner->dirty(); }
@ -363,6 +365,7 @@ void TSpreadsheet::update_rec(int rec)
}
}
void TSpreadsheet::set_focus_cell(int riga, int colonna)
{
set_front_window(win()); // It seems necessary to make xi_set_focus work properly
@ -524,13 +527,9 @@ break;
}
break;
case XIE_CHG_CELL:
if (!_row_dirty)
{
notify(_cur_row, K_SPACE);
_row_dirty = TRUE;
}
_cell_dirty = TRUE;
break;
notify_change();
_cell_dirty = TRUE;
break;
case XIE_BUTTON:
if (xiev->v.xi_obj->type == XIT_CELL)
dispatch_e_char(win(), K_F9);
@ -540,15 +539,18 @@ break;
break;
case XIE_SELECT:
if (xiev->v.xi_obj->type == XIT_ROW)
{
if (!_row_dirty)
{
notify(_cur_row, K_SPACE);
_row_dirty = TRUE;
{
const int oldrec = _cur_rec;
set_pos(xiev->v.select.xi_obj->v.row, xiev->v.select.column);
if (oldrec != _cur_rec)
{
str2mask(_cur_rec);
_row_dirty = FALSE;
}
TMask_field* f = col2field(xiev->v.select.column);
f->on_hit();
mask2str(_cur_row);
_edit_field = col2field(_cur_col);
notify_change();
_edit_field->on_hit();
mask2str(_cur_rec);
}
xiev->refused = TRUE;
break;
@ -556,21 +558,22 @@ break;
{
_check_enabled = FALSE;
const int oldrow = _cur_row;
_cur_row = row2rec(xiev->v.xi_obj->v.cell.row);
_cur_col = xiev->v.xi_obj->v.cell.column;
const int oldrec = _cur_rec;
set_pos(xiev->v.xi_obj->v.cell.row, xiev->v.xi_obj->v.cell.column);
if (oldrow != _cur_row || !_row_dirty)
notify(_cur_row, K_SPACE);
const KEY k = edit(_cur_row);
if (oldrec != _cur_rec || !_row_dirty)
{
_row_dirty = FALSE;
notify_change();
}
const KEY k = edit(_cur_rec);
if (k == K_ENTER)
{
update_rec(_cur_row);
update_rec(_cur_rec);
_row_dirty = TRUE;
}
if (!cell_disabled(_cur_row, _cur_col))
if (!cell_disabled(_cur_rec, _cur_col))
set_focus_cell(_cur_row, _cur_col);
_check_enabled = TRUE;
}
@ -589,27 +592,29 @@ break;
case XIE_ON_ROW:
if (_check_enabled)
{
const int rec = row2rec(xiev->v.xi_obj->v.row);
if (rec < items())
set_pos(xiev->v.xi_obj->v.row, _cur_col);
if (_cur_rec < items())
{
_cur_row = rec;
str2mask(rec);
str2mask(_cur_rec);
_row_dirty = FALSE;
}
else
{
_cur_row = _cur_rec = 0;
xiev->refused = TRUE;
}
}
break;
case XIE_OFF_ROW:
if (_row_dirty && _check_enabled)
{
_check_enabled = FALSE; // Avoid recursion!
str2mask(_cur_row); // It shouldn't have to be necessary
str2mask(_cur_rec); // It shouldn't have to be necessary
bool ok = sheet_mask().check_fields();
if (ok)
{
mask2str(_cur_row);
ok = notify(_cur_row, K_ENTER); // Notify edit
mask2str(_cur_rec);
ok = notify(_cur_rec, K_ENTER); // Notify edit
}
if (!ok)
{
@ -628,7 +633,7 @@ break;
{
TMask_field* f = cell2field(xiev->v.xi_obj);
const int col = (f->dlg()-FIRST_FIELD) % 100;
if (cell_disabled(_cur_row, col)) // If the cell is disabled ...
if (cell_disabled(_cur_rec, col)) // If the cell is disabled ...
{
dispatch_e_char(win(), _lastab); // ... skip to the next one.
}
@ -656,7 +661,7 @@ break;
}
else
{
mask2str(_cur_row); // Update sheet row
mask2str(_cur_rec); // Update sheet row
_edit_field = NULL; // Reset current field
}
}
@ -712,14 +717,10 @@ break;
if (_check_enabled)
{
_check_enabled = FALSE; // Disable checks
if (!_row_dirty)
{
notify(_cur_row, K_SPACE);
_row_dirty = TRUE;
}
notify_change();
if (_edit_field->on_key(k))
{
mask2str(_cur_row);
mask2str(_cur_rec);
}
else
{
@ -1084,14 +1085,22 @@ void TSpreadsheet::str2mask(int riga)
// Certified 100%
bool TSpreadsheet::notify(int n, KEY k)
bool TSpreadsheet::notify(int rec, KEY k)
{
const bool ok = _notify ? _notify(n, k) : TRUE;
const bool ok = _notify ? _notify(rec, k) : TRUE;
if (k == K_ENTER)
set_dirty(ok ? TRUE : 3);
return ok;
}
void TSpreadsheet::notify_change()
{
if (!_row_dirty)
{
notify(_cur_rec, K_SPACE);
_row_dirty = TRUE;
}
}
// Certified 99%
#if XVT_OS != XVT_OS_WIN

View File

@ -362,7 +362,7 @@ void TEvent_manager::push(WINDOW w, const EVENT& e)
_e[_end] = e;
const int next = (_end+1) % MAX;
if (next == _begin)
error_box("Hey %s, clicca piu' piano!", (const char*)main_app().user());
warning_box("Hey %s, clicca piu' piano!", (const char*)main_app().user());
else
_end = next;
}