Corretto problemino col focus degli sheet

Aggiunta possibilita' di cambiare il prompt di un groupbox


git-svn-id: svn://10.65.10.50/trunk@948 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 1995-02-01 18:04:04 +00:00
parent 1fd60f8e2c
commit d72f84feb1
8 changed files with 45 additions and 19 deletions

View File

@ -401,6 +401,12 @@ void TControl::update() const
win_set_fore_color(_hdc, disabled() ? DISABLED_COLOR : NORMAL_COLOR);
}
void TControl::set_caption(const char* t)
{
_caption = t;
update();
}
///////////////////////////////////////////////////////////
// TText
///////////////////////////////////////////////////////////

View File

@ -86,6 +86,7 @@ public:
WINDOW win() const { return _win; }
short id() const { return _id; }
const char* caption() const { return _caption; }
void set_caption(const char* c);
bool checked() const { return _checked; }
virtual void check(bool on);

View File

@ -646,7 +646,7 @@ int TMask::find_active_field(int first, int dir) const
}
void TMask::set_focus()
{
{
_focus = find_active_field(_focus, +1);
const TMask_field& f = fld(_focus);
const int page = find_parent_page(f);

View File

@ -1,4 +1,4 @@
// $Id: maskfld.cpp,v 1.74 1995-01-31 16:15:29 guy Exp $
// $Id: maskfld.cpp,v 1.75 1995-02-01 18:03:51 guy Exp $
#include <xvt.h>
#include <applicat.h>
@ -393,8 +393,7 @@ void TMask_field::set_dirty(bool d)
// Certified 99%
const char* TMask_field::get_window_data() const
{
get_title(win(), __fpark, MAXSTR);
return __fpark;
return get_title(win(), __fpark, MAXSTR);
}
@ -728,8 +727,8 @@ bool TMask_field::do_message(int num)
bool TMask_field::test_focus_change()
{
bool ok = TRUE;
if (focusdirty()) on_key(K_TAB);
else if (is_edit() && get().not_empty()) on_hit();
if (focusdirty()) on_key(K_TAB); // Comportamento normale
else if (is_edit() && in_key(1)) on_hit(); // Serve per eseguire gli handler autoprementi
return ok;
}
@ -3153,10 +3152,16 @@ void TGroup_field::parse_head(TScanner& scanner)
_size = scanner.integer();
}
void TGroup_field::create(WINDOW parent)
{
const long f = _flags.rightjust ? CTL_FLAG_MULTIPLE : 0;
wincreate(WC_GROUPBOX, _width, _size, _prompt, parent, f);
}
void TGroup_field::set_window_data(const char* data)
{ xvt_set_title(win(), data); }
void TGroup_field::set_field_data(const char* data)
{ xvt_set_title(win(), data); }

View File

@ -1,4 +1,4 @@
/* $Id: maskfld.h,v 1.21 1995-01-26 13:57:41 guy Exp $ */
/* $Id: maskfld.h,v 1.22 1995-02-01 18:03:56 guy Exp $ */
#ifndef __MASKFLD_H
#define __MASKFLD_H
@ -562,6 +562,8 @@ protected:
// @DPROT
virtual void parse_head(TScanner& scanner);
virtual void create(WINDOW parent);
virtual void set_window_data(const char* data);
virtual void set_field_data(const char* data);
public:
// @FPUB

View File

@ -369,7 +369,7 @@ void TSpreadsheet::set_focus_cell(int riga, int colonna)
const int r = row2rec(riga);
for (; colonna < _columns; colonna++)
if (!cell_disabled(r, colonna-1))
if (!cell_disabled(r, colonna-1))
break;
if (colonna < _columns)
@ -556,8 +556,11 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
}
break;
case XIE_CHG_CELL:
notify_change();
_cell_dirty = TRUE;
if (_edit_field)
{
notify_change();
_edit_field->set_focusdirty(_cell_dirty = TRUE);
}
break;
case XIE_BUTTON:
if (xiev->v.xi_obj->type == XIT_CELL)
@ -673,7 +676,7 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
{
_edit_field = f;
_cur_col = xiev->v.xi_obj->v.cell.column;
_cell_dirty = FALSE;
_edit_field->set_focusdirty(_cell_dirty = FALSE);
}
}
break;
@ -688,15 +691,12 @@ void TSpreadsheet::list_handler(XI_EVENT *xiev)
c->set(nuo); // Set new mask value
c->set_dirty(); // Get it dirty!
if (c->on_key(c->is_edit() ? K_TAB : K_SPACE) == FALSE) // Test it
{
xiev->refused = *nuo != '\0';
}
else
{
mask2str(_cur_rec); // Update sheet row
_edit_field = NULL; // Reset current field
}
}
if (!xiev->refused)
_edit_field = NULL; // Reset current field
_check_enabled = TRUE;
}
break;
@ -1296,8 +1296,8 @@ void TSheet_field::highlight() const
if (items())
{
_sheet->_firstfocus = FALSE;
_sheet->_edit_field = NULL;
_sheet->set_focus_cell(0, 1);
if (_sheet->_edit_field == NULL)
_sheet->set_focus_cell(0, 1);
}
#endif
}

View File

@ -756,6 +756,17 @@ const char* xvt_get_title(WINDOW win)
#endif
}
void xvt_set_title(WINDOW win, const char* cap)
{
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)
TControl* c = TControl::WINDOW2TControl(win);
c->set_caption(cap);
#else
set_title(win, cap);
#endif
}
void xvt_set_front_control(WINDOW win)
{
#if XVT_OS == XVT_OS_WIN && !defined(__CTL3D__)

View File

@ -56,6 +56,7 @@ WINDOW xvt_create_window
void xvt_set_font(WINDOW win, int family, int style, int dim = 0);
void xvt_set_front_control(WINDOW win);
const char* xvt_get_title(WINDOW win);
void xvt_set_title(WINDOW win, const char* title);
void xvt_enable_control(WINDOW win, bool on);
void xvt_check_box(WINDOW win, bool on);
bool xvt_get_checked_state(WINDOW win);