Aggiunto metodo per sapere quale sara' il campo che' prendera'

git-svn-id: svn://10.65.10.50/trunk@1187 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 1995-03-29 14:21:05 +00:00
parent 5ceac3fb47
commit f51135451c
3 changed files with 28 additions and 12 deletions

View File

@ -24,7 +24,9 @@ bool TMask::test_focus_change(WINDOW next)
{
bool ok = TRUE;
TMask_field& prev = fld(_focus);
TMask_field& prev = fld(_focus);
_next_fld = next == NULL_WIN ? DLG_NULL : fld(find_field_win(next)).dlg();
if (prev.win() != next)
{
ok = prev.test_focus_change();
@ -440,7 +442,9 @@ void TMask::start_run()
load_checks();
const int max = fields();
const int max = fields();
_next_fld = DLG_NULL;
for (int i = 0; i < max; i++)
{
TMask_field& f = fld(i);
@ -673,8 +677,6 @@ void TMask::set_focus()
// Move the focus to the next (+1) or previous(-1) valid control
void TMask::move_focus_field(int d)
{
if (!test_focus_change())
return;
TMask_field& f = fld(_focus);
if (f.class_id() == CLASS_RADIO_FIELD)
@ -687,6 +689,10 @@ void TMask::move_focus_field(int d)
}
const int focus = find_active_field(_focus+d, d);
if (!test_focus_change(fld(focus).win()))
return;
if (fld(focus).parent() == f.parent() || check_current_page())
_focus = focus;
@ -694,7 +700,7 @@ void TMask::move_focus_field(int d)
}
bool TMask::stop_run(KEY key)
{
{
if (key != K_AUTO_ENTER && key != K_FORCE_CLOSE)
{
const int last = fields();
@ -732,7 +738,10 @@ bool TMask::stop_run(KEY key)
if (!ok) return FALSE;
}
if (is_running()) // Gestisce correttamenete le maschere chiuse
{
get_mask_fields();
_next_fld = DLG_NULL;
}
return TWindow::stop_run(key);
}
@ -919,7 +928,7 @@ int TMask::find_first_field(WINDOW w, int dir) const
bool TMask::check_current_page()
{
if (!test_focus_change())
if (!test_focus_change())
return FALSE;
/*

View File

@ -40,7 +40,8 @@ class TMask : public TWindow
TArray _field; // Fields in the mask
int _first_focus; // First control to have focus
int _focus; // Control with focus
int _focus; // Control with focus
int _next_fld; // Control who is gaining the focus
int _sheets; // Number of sheets
MASK_HANDLER _handler; // User defined key handler
@ -129,7 +130,8 @@ public:
virtual void close();
virtual void activate(bool on = TRUE);
int id2pos(short id) const;
int id2pos(short id) const;
short next_fld() const { return _next_fld;} // id of the field who is gaining the focus DLG_NULL is not exists
TMask_field& fld(int i) const { return (TMask_field&)_field[i]; } // Ritorna il campo i-esimo della maschera
TMask_field& field(short id) const; // field with given id
TEdit_field& efield(short id) const; // edit-field with given id

View File

@ -5,7 +5,7 @@
#include <execp.h>
#include <mailbox.h>
#include <mask.h>
#include <prefix.h>
#include <prefix.h>
#include <relation.h>
#include <sheet.h>
#include <tabutil.h>
@ -1637,7 +1637,7 @@ bool TBrowse::empty_check()
TEdit_field::TEdit_field(TMask* mask)
: TMask_field(mask), _browse(NULL), _sheet(NULL),
_buttonwin(NULL_WIN), _check(CHECK_NONE), _check_enabled(TRUE),
_buttonwin(NULL_WIN), _check(CHECK_NONE), _check_enabled(FALSE),
_forced(FALSE)
{}
@ -1770,6 +1770,7 @@ bool TEdit_field::parse_item(TScanner& scanner)
_browse->set_insert(tabmaskname);
}
_check_enabled = TRUE;
return TRUE;
}
@ -1783,8 +1784,11 @@ bool TEdit_field::parse_item(TScanner& scanner)
if (what == "US" || what == "AL")
_browse = new TBrowse(this, b->cursor());
if (_browse)
if (_browse)
{
_check_enabled = TRUE;
return _browse->parse_copy(what, *b);
}
#ifdef DBG
return yesnofatal_box("Impossibile COPY senza USE nel campo %d", dlg());
@ -1805,7 +1809,8 @@ bool TEdit_field::parse_item(TScanner& scanner)
#ifdef DBG
if (_sheet) return yesnofatal_box("SHEET duplicato nel campo %d", dlg());
#endif
_sheet = new TList_sheet(this, _prompt, scanner.string());
_sheet = new TList_sheet(this, _prompt, scanner.string());
_check_enabled = TRUE;
return TRUE;
}