Patch level : 12.0 1044

Files correlati     : no patch
Commento            :

Aggiunta TIBAN_mask
This commit is contained in:
Alessandro Bonazzi 2021-03-25 09:13:03 +01:00
parent 0522dbd548
commit f171ee3170
2 changed files with 60 additions and 0 deletions

View File

@ -361,3 +361,44 @@ TVariable_automask::TVariable_automask(const char* name, int num)
{
set_handlers();
}
bool TIBAN_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
TMask & m = o.mask();
short dlg = o.dlg();
if (dlg == _stato && (e == fe_init || e == fe_modify))
{
const TString & iso = o.get();
const bool italy = iso.blank() || iso == "IT";
if (_bban > 0)
m.show(_bban, !italy);
m.show(_conto, italy);
if (e == fe_modify)
{
if (iso != _last_iso)
{
const TString iban = m.get(_iban);
set_iban_fields(iban.blank() || iban.left(2) != iso ? iso : iban, m, _bban, _stato, _check, _cin, _abi, _cab, _conto, _desban, _pres);
}
_last_iso = iso;
}
else
{
enable_iban_fields(m, _bban, _cin, _abi, _cab, _conto, _desban, italy, _pres);
_last_iso = "*";
}
}
else
if (dlg == _iban && (e == fe_init || e == fe_modify /* || e == fe_close*/))
{
const TString & iban = o.get();
set_iban_fields(iban, m, _bban, _stato, _check, _cin, _abi, _cab, _conto, _desban, _pres);
}
return true;
}

View File

@ -75,4 +75,23 @@ public:
virtual ~TSimpleAutomask() { }
};
class TIBAN_mask : public TAutomask
{
TString _last_iso;
short _stato, _check, _cin, _abi, _cab, _conto, _iban, _bban, _desban;
int _pres;
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TIBAN_mask(const char *name, short stato, short check, short cin, short abi,
short cab, short conto, short iban, short bban = -1,
short desban = -1, int pres = 0)
: TAutomask(name), _stato(stato), _check(check), _cin(cin), _abi(abi),
_cab(cab), _conto(conto), _iban(iban), _bban(bban), _desban(desban),
_pres(pres) {}
};
#endif