Aggiunto campo browsefile alle maschere

git-svn-id: svn://10.65.10.50/trunk@681 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1994-11-22 09:43:24 +00:00
parent af8011c9d1
commit 91f21eef2a
6 changed files with 75 additions and 7 deletions

View File

@ -8,12 +8,13 @@ BEGIN
HELP "Codice della ditta da attivare"
FLAGS "FR"
USE LF_NDITTE KEY 1
CHECKTYPE NORMAL
INPUT CODDITTA F_CODDITTA
DISPLAY "Codice" CODDITTA
DISPLAY "Ragione sociale@50" RAGSOC
OUTPUT F_CODDITTA CODDITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
WARNING "Ditta assente"
KEY 1
GROUP 1
END

28
include/browfile.h Executable file
View File

@ -0,0 +1,28 @@
#ifndef __BROWFILE_H
#define __BROWFILE_H
#ifndef __SCANNER_H
#include <scanner.h>
#endif
class TViswin;
class TBrowsefile_field : public TMask_field
{
TViswin* _viswin;
protected:
virtual word class_id() const;
virtual void parse_head(TScanner& scanner);
virtual bool parse_item(TScanner& scanner);
virtual void create(WINDOW parent);
public:
TViswin* vis_win() const { return _viswin; }
TBrowsefile_field(TMask* m);
virtual ~TBrowsefile_field();
};
#endif

View File

@ -29,11 +29,12 @@
#define CLASS_EDIT_FIELD 21
#define CLASS_REAL_FIELD 22
#define CLASS_DATE_FIELD 23
#define CLASS_BOOLEAN_FIELD 30
#define CLASS_LIST_FIELD 31
#define CLASS_RADIO_FIELD 32
#define CLASS_BUTTON_FIELD 40
#define CLASS_SHEET_FIELD 50
#define CLASS_BOOLEAN_FIELD 24
#define CLASS_LIST_FIELD 25
#define CLASS_RADIO_FIELD 26
#define CLASS_BUTTON_FIELD 27
#define CLASS_SHEET_FIELD 28
#define CLASS_BROWSEFILE_FIELD 29
// @END
#endif // __CLASSES_H

View File

@ -2,6 +2,7 @@
#include <stdio.h>
#include <applicat.h>
#include <browfile.h>
#include <colors.h>
#include <msksheet.h>
#include <relation.h>
@ -507,6 +508,7 @@ void TMask::get_mask_fields()
}
}
int TMask::id2pos(short id) const
{
const int MAX_FIELDS = 256;
@ -556,6 +558,7 @@ TMask_field& TMask::field(short id) const
return fld(pos);
}
TEdit_field& TMask::efield(short id) const
{
TMask_field& f = field(id);
@ -563,6 +566,7 @@ TEdit_field& TMask::efield(short id) const
return (TEdit_field&)f;
}
int TMask::find_field_win(WINDOW win) const
{
if (fld(_focus).win() == win)
@ -807,6 +811,8 @@ TMask_field* TMask::parse_field(TScanner& scanner)
_sheets++;
return new TSheet_field(this);
}
if (scanner.key() == "BR") return new TBrowsefile_field(this);
return NULL;
}

View File

@ -65,6 +65,7 @@ public:
int insert(int rec);
bool destroy(int rec = -1);
void enable(bool on);
void enable_column(int col, bool on = TRUE);
void enable_cell(int row, int column, bool on = TRUE);
bool cell_disabled(int row, int column) const;
@ -896,6 +897,29 @@ void TSpreadsheet::enable_cell(int row, int column, bool on)
}
void TSpreadsheet::enable(bool on)
{
const dword old = xi_get_attrib(_list);
const dword att = on ? (old & ~XI_ATR_READONLY) : (old | XI_ATR_READONLY);
if (old != att)
{
int num;
XI_OBJ** columns = xi_get_member_list(_list, &num);
xi_move_focus(_itf); // Set focus to interface
xi_set_attrib(_list, att);
for (int col = 1; col < num; col++)
{
XI_OBJ* column = columns[col];
dword attr = xi_get_attrib(column);
if (on) attr &= ~XI_ATR_READONLY;
else attr |= XI_ATR_READONLY;
xi_set_attrib(column, attr); // Set new attributes
}
}
}
void TSpreadsheet::enable_column(int col, bool on)
{
const bool change = _column_disabled[col] == on;
@ -908,7 +932,7 @@ void TSpreadsheet::enable_column(int col, bool on)
CHECKD(col+1 < num, "Can't enable column ", col);
XI_OBJ* column = columns[col+1];
long attr = xi_get_attrib(column);
dword attr = xi_get_attrib(column);
if (on) attr |= XI_ATR_ENABLED;
else attr &= ~XI_ATR_ENABLED;
@ -1152,6 +1176,11 @@ void TSheet_field::set_notify(SPREADSHEET_NOTIFY n)
}
void TSheet_field::enable(bool on)
{
_sheet->enable(on);
}
void TSheet_field::enable_column(int column, bool on)
{
_sheet->enable_column(column, on);

View File

@ -34,11 +34,14 @@ public:
int selected() const; // Number of current row
virtual void reset();
virtual void enable(bool on);
void destroy(int r = -1); // Destroy row
void force_update(int r = -1);// Update data/screen
TMask& sheet_mask() const;
void set_notify(SPREADSHEET_NOTIFY n);
void enable_column(int col, bool on = TRUE);
void enable_cell(int row, int column, bool on = TRUE);
void disable_cell(int row, int column) { enable_cell(row, column, FALSE); }