Modificati sheet con bottone
git-svn-id: svn://10.65.10.50/trunk@1136 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
911467bab7
commit
f83e091ba4
@ -45,8 +45,6 @@ class TSpreadsheet : public TWindow
|
||||
bool _row_dirty; // Current row changed
|
||||
bool _check_enabled; // Perform OFF_ROW and OFF_CELL checks
|
||||
bool _update; // It's safe to update the display
|
||||
|
||||
TString16 _button;
|
||||
|
||||
static void xiev_handler(XI_OBJ *itf, XI_EVENT *xiev);
|
||||
void init();
|
||||
@ -221,12 +219,27 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
listdef->v.list->min_cell_height = CHARY;
|
||||
listdef->v.list->min_heading_height = CHARY;
|
||||
listdef->v.list->white_space_color = MASK_DARK_COLOR;
|
||||
|
||||
XI_OBJ_DEF* coldef = xi_add_column_def(listdef, 0,
|
||||
XI_ATR_RJUST, 0, NUMBER_WIDTH, NUMBER_WIDTH, "");
|
||||
|
||||
word attr = XI_ATR_RJUST;
|
||||
if (_mask.id2pos(FIRST_FIELD -1) != -1)
|
||||
attr |= XI_ATR_SELECTABLE;
|
||||
|
||||
XI_OBJ_DEF* coldef = xi_add_column_def(listdef, 0, attr, 0, NUMBER_WIDTH, NUMBER_WIDTH,
|
||||
attr & XI_ATR_SELECTABLE ? "X" : "");
|
||||
|
||||
coldef->v.column->heading_platform = TRUE;
|
||||
coldef->v.column->column_platform = TRUE;
|
||||
coldef->v.column->center_heading = TRUE;
|
||||
|
||||
if (attr & XI_ATR_SELECTABLE)
|
||||
{
|
||||
coldef->v.column->icon_rid = ICO_SEARCH;
|
||||
coldef->v.column->icon_x = 2; // (v_width[i]*CHARX-16) >> 1;
|
||||
// coldef->v.column->icon_y = (CHARY-16) >> 1;
|
||||
listdef->v.list->min_heading_height = 16;
|
||||
}
|
||||
else
|
||||
coldef->v.column->center_heading = TRUE;
|
||||
|
||||
|
||||
for (h = new_header.get(0), i = 0; h; h = new_header.get(), i++)
|
||||
{
|
||||
@ -252,19 +265,19 @@ TSpreadsheet::TSpreadsheet(short x, short y, short dx, short dy,
|
||||
(char*)(const char*)testo);
|
||||
coldef->v.column->heading_platform = TRUE;
|
||||
coldef->v.column->center_heading = TRUE;
|
||||
if (acqua == CLASS_BUTTON_FIELD)
|
||||
{
|
||||
const TFixed_string testa(header.get(i));
|
||||
const int diesis = testa.find('#');
|
||||
if (diesis > 0)
|
||||
{
|
||||
_button = testa.mid(diesis+1);
|
||||
coldef->v.column->icon_x = (v_width[i]*CHARX-16) >> 1;
|
||||
coldef->v.column->icon_y = (CHARY-16) >> 1;
|
||||
coldef->v.column->column_platform = TRUE;
|
||||
}
|
||||
else _button = testo;
|
||||
}
|
||||
// if (acqua == CLASS_BUTTON_FIELD)
|
||||
// {
|
||||
// const TFixed_string testa(header.get(i));
|
||||
// const int diesis = testa.find('#');
|
||||
// if (diesis > 0)
|
||||
// {
|
||||
// _button = testa.mid(diesis+1);
|
||||
// coldef->v.column->icon_x = (v_width[i]*CHARX-16) >> 1;
|
||||
// coldef->v.column->icon_y = (CHARY-16) >> 1;
|
||||
// coldef->v.column->column_platform = TRUE;
|
||||
// }
|
||||
// else _button = testo;
|
||||
// }
|
||||
}
|
||||
|
||||
RCT itfrct;
|
||||
@ -532,30 +545,35 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
TMask_field* f = field(cid);
|
||||
const int acqua = f->class_id();
|
||||
|
||||
if (acqua == CLASS_BUTTON_FIELD)
|
||||
{
|
||||
if (isdigit(_button[0]))
|
||||
xiev->v.cell_request.icon_rid = atoi(_button);
|
||||
else
|
||||
src = _button;
|
||||
}
|
||||
else
|
||||
// if (acqua == CLASS_BUTTON_FIELD)
|
||||
// {
|
||||
// if (isdigit(_button[0]))
|
||||
// xiev->v.cell_request.icon_rid = atoi(_button);
|
||||
// else
|
||||
// src = _button;
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
src = row(rec).get(col); // Set value for cell
|
||||
if (src && *src && f->is_edit())
|
||||
{
|
||||
src = row(rec).get(col); // Set value for cell
|
||||
if (src && *src && f->is_edit())
|
||||
{
|
||||
src = f->picture_data(src, FALSE); // Get formatted string
|
||||
}
|
||||
if (field(cid)->has_query())
|
||||
{
|
||||
xiev->v.cell_request.button = TRUE;
|
||||
xiev->v.cell_request.button_on_focus = TRUE;
|
||||
}
|
||||
if (cell_disabled(rec, col))
|
||||
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
||||
src = f->picture_data(src, FALSE); // Get formatted string
|
||||
}
|
||||
if (field(cid)->has_query())
|
||||
{
|
||||
xiev->v.cell_request.button = TRUE;
|
||||
xiev->v.cell_request.button_on_focus = TRUE;
|
||||
}
|
||||
if (cell_disabled(rec, col))
|
||||
xiev->v.cell_request.back_color = DISABLED_BACK_COLOR;
|
||||
// }
|
||||
}
|
||||
} else src = format("%d", rec+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
src = format("%d", rec+1);
|
||||
xiev->v.cell_request.color = COLOR_RED;
|
||||
}
|
||||
|
||||
char* dst = xiev->v.cell_request.s;
|
||||
if (src && *src)
|
||||
@ -596,12 +614,15 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
|
||||
|
||||
update(_cur_rec);
|
||||
|
||||
TMask_field* button = col2field(_cur_col);
|
||||
button->on_hit();
|
||||
if (_mask.dirty())
|
||||
{
|
||||
notify_change();
|
||||
mask2str(_cur_rec);
|
||||
if (_mask.id2pos(FIRST_FIELD-1) != -1)
|
||||
{
|
||||
TMask_field* button = &_mask.field(FIRST_FIELD-1);
|
||||
button->on_hit();
|
||||
if (_mask.dirty())
|
||||
{
|
||||
notify_change();
|
||||
mask2str(_cur_rec);
|
||||
}
|
||||
}
|
||||
_check_enabled = TRUE;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user