#include #include "in0.h" #include "in0700a.h" #include "inlib01.h" /////////////////////////////////////////////////////////// // TRettifiche_mask /////////////////////////////////////////////////////////// class TRettifiche_mask : public TIntra_mask { protected: virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly); virtual short type_field() const { return F_TIPO; } virtual short period_field() const { return F_PERIODO_M; } public: TRettifiche_mask(); virtual ~TRettifiche_mask() { } }; bool TRettifiche_mask::on_field_event(TOperable_field& o, TField_event e, long jolly) { bool ok = TIntra_mask::on_field_event(o, e, jolly); if (ok) switch (o.dlg()) { case F_TIPO: if (e == fe_init || e == fe_modify) { // Ripeto il comportamento standard sul periodo di rettifica show(O_PERIODO_M, field(F_PERIODO_M).shown()); show(O_PERIODO_T, field(F_PERIODO_T).shown()); show(O_PERIODO_A, field(F_PERIODO_A).shown()); } break; case O_NUM_RIG: if ((e == fe_init || e == fe_modify) && !o.empty()) { TEdit_field& ef = (TEdit_field&)o; ef.check(); TCursor& cur = *ef.browse()->cursor(); bool ok = cur.ok(); enable(-GR_ORIGINAL, !ok); if (e == fe_modify && insert_mode()) { for (short dlg = O_STATO; dlg <= O_NOMENCLATURA; dlg++) { const int pos = id2pos(dlg); if (pos >= 0) set(dlg + F_STATO - O_STATO, fld(pos).get()); } } } break; default: break; } return ok; } TRettifiche_mask::TRettifiche_mask() :TIntra_mask("in0700a") { first_focus(F_TIPO); } /////////////////////////////////////////////////////////// // Applicazione principale /////////////////////////////////////////////////////////// class TRettifiche_intra : public TRelation_application { TRelation* _rel; TMask* _msk; protected: virtual bool user_create(); virtual TRelation* get_relation() const { return _rel; } virtual TMask* get_mask(int) { return _msk; } virtual bool changing_mask(int mode) { return FALSE; } virtual bool user_destroy(); public: }; bool TRettifiche_intra::user_create() { open_files(LF_TABCOM, LF_TAB, LF_CLIFO, LF_RIEPRETT, 0); _rel = new TRelation(LF_RIEPRETT); _msk = new TRettifiche_mask; return TRUE; } bool TRettifiche_intra::user_destroy() { delete _msk; delete _rel; return TRUE; } int in0700(int argc, char* argv[]) { TRettifiche_intra a; a.run(argc, argv, "Rettifiche INTRA"); return 0; }