From d72f84feb11fe1f8d887045f4656acc4134ebeef Mon Sep 17 00:00:00 2001 From: guy Date: Wed, 1 Feb 1995 18:04:04 +0000 Subject: [PATCH] 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 --- include/controls.cpp | 6 ++++++ include/controls.h | 1 + include/mask.cpp | 2 +- include/maskfld.cpp | 17 +++++++++++------ include/maskfld.h | 4 +++- include/msksheet.cpp | 22 +++++++++++----------- include/xvtility.cpp | 11 +++++++++++ include/xvtility.h | 1 + 8 files changed, 45 insertions(+), 19 deletions(-) diff --git a/include/controls.cpp b/include/controls.cpp index 5471efb53..1bbc646b8 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -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 /////////////////////////////////////////////////////////// diff --git a/include/controls.h b/include/controls.h index cbbdb63f5..c3eaaf711 100755 --- a/include/controls.h +++ b/include/controls.h @@ -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); diff --git a/include/mask.cpp b/include/mask.cpp index 1b16b51a6..4841458bc 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -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); diff --git a/include/maskfld.cpp b/include/maskfld.cpp index 1d5c14404..46e94d3cc 100755 --- a/include/maskfld.cpp +++ b/include/maskfld.cpp @@ -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 #include @@ -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); } + diff --git a/include/maskfld.h b/include/maskfld.h index 81403a350..a885faf70 100755 --- a/include/maskfld.h +++ b/include/maskfld.h @@ -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 diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 6330c48fd..3c6aec216 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -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 } diff --git a/include/xvtility.cpp b/include/xvtility.cpp index c531c1e59..086318def 100755 --- a/include/xvtility.cpp +++ b/include/xvtility.cpp @@ -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__) diff --git a/include/xvtility.h b/include/xvtility.h index 6aa49cd1b..551ddbbcc 100755 --- a/include/xvtility.h +++ b/include/xvtility.h @@ -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);