diff --git a/include/msksheet.cpp b/include/msksheet.cpp index 080425104..38cb36126 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -1234,8 +1234,8 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) int num; XI_OBJ** column = xi_get_member_list(_obj, &num); CHECK(cell.column < num, "Bad column"); - int rec = cell.row; - rec = row2rec(rec); + int row = cell.row; + const int rec = row2rec(row); const int col = column[cell.column]->cid - FIRST_FIELD; if (!cell_disabled(rec, col)) { @@ -1569,7 +1569,7 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) //gestione campi che non appaiono nello sheet ma che possono essere usati nelle ricerche //es: per evitare di avere il valore della prima colonna in una descrizione che si puo' usere.. //..per le ricerche, ma che non appare nello sheet (es. ca2100a.uml) - if (cid2index(_edit_field->dlg()) == 0 || _cur_col > 1) + if (cid2index(_edit_field->dlg()) == 0 || _cur_col > 0) copy_cell2field(); _edit_field->set_dirty(_cell_dirty = spork); // TBT diff --git a/include/tree.cpp b/include/tree.cpp index 5a1c1bd8f..0639d0483 100755 --- a/include/tree.cpp +++ b/include/tree.cpp @@ -225,6 +225,9 @@ bool TTree::has_rbrother() const return ok; } +bool TTree::could_have_son() const +{ return has_son(); } + bool TTree::has_son() const { TString myself; curr_id(myself); @@ -324,7 +327,7 @@ TImage* TTree::get_res_icon(short icon_id) const TImage* TTree::image(bool selected) const { short bmp_id = BMP_FILE; - if (has_son()) + if (could_have_son()) bmp_id = selected ? BMP_DIRDN : BMP_DIR; return get_res_image(bmp_id); } diff --git a/include/tree.h b/include/tree.h index ac1d432bd..dae078fa8 100755 --- a/include/tree.h +++ b/include/tree.h @@ -39,6 +39,7 @@ public: virtual bool has_root() const; virtual bool has_father() const; + virtual bool could_have_son() const; // Is not terminal node virtual bool has_son() const; virtual bool has_lbrother() const; virtual bool has_rbrother() const; diff --git a/include/treectrl.cpp b/include/treectrl.cpp index e8a92a72f..b5e2935b1 100755 --- a/include/treectrl.cpp +++ b/include/treectrl.cpp @@ -132,7 +132,7 @@ RCT& TWindowed_field::get_rect(RCT& r) const if (_win) xvt_vobj_get_outer_rect(_win->win(), &r); else - xvt_rect_set_empty(&r); + xvt_rect_set_null(&r); return r; } @@ -197,6 +197,15 @@ long TControl_host_window::handler(WINDOW win, EVENT* ep) { switch (ep->type) { + case E_FOCUS: + if (ep->v.active) + { + if (_ctrl != NULL_WIN && _ctrl != win) + xvt_scr_set_focus_vobj(_ctrl); + owner().mask().notify_focus_field(owner().dlg()); + return 0L; + } + break; case E_SIZE: if (_ctrl != NULL_WIN) { @@ -215,6 +224,12 @@ long TControl_host_window::handler(WINDOW win, EVENT* ep) return TField_window::handler(win, ep); } +void TControl_host_window::set_focus() +{ + if (_ctrl != NULL_WIN) + xvt_scr_set_focus_vobj(_ctrl); +} + TControl_host_window::TControl_host_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner) : TField_window(x, y, dx, dy, parent, owner), _ctrl(NULL_WIN) @@ -257,8 +272,8 @@ public: bool TTree_window::add_child(XVT_TREEVIEW_NODE parent) { - XVT_TREEVIEW_NODE_TYPE type = _tree->has_son() ? XVT_TREEVIEW_NODE_NONTERMINAL - : XVT_TREEVIEW_NODE_TERMINAL; + XVT_TREEVIEW_NODE_TYPE type = _tree->could_have_son() ? XVT_TREEVIEW_NODE_NONTERMINAL + : XVT_TREEVIEW_NODE_TERMINAL; if (_hide_leaves && type == XVT_TREEVIEW_NODE_TERMINAL) return false; diff --git a/include/treectrl.h b/include/treectrl.h index 1bc08c9ec..560347e71 100755 --- a/include/treectrl.h +++ b/include/treectrl.h @@ -17,6 +17,8 @@ protected: protected: virtual long handler(WINDOW win, EVENT* ep); + virtual void set_focus(); + TControl_host_window(int x, int y, int dx, int dy, WINDOW parent, TWindowed_field* owner); };