diff --git a/include/applicat.cpp b/include/applicat.cpp index ff866e246..1333fa036 100755 --- a/include/applicat.cpp +++ b/include/applicat.cpp @@ -319,7 +319,7 @@ void TApplication::terminate() if (_create_ok) { destroy(); // Distruzione files e maschere -#if XVT_OS == XVT_OS_WIN +#if XVT_OS == XVT_OS_WIN || XVT_OS == XVT_OS_NT const word WM_WAKEUP = RegisterWindowMessage("WAKEUP"); const HTASK ht = GetCurrentTask(); SendMessage(HWND_BROADCAST, WM_WAKEUP, (unsigned int)ht, 0L); diff --git a/include/controls.cpp b/include/controls.cpp index 885de43de..67f67c572 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -187,6 +187,38 @@ XVT_FNTID xvt_load_default_font() static byte event_map[XIE_POST_NAVIGATION+1]; enum event_action { a_ignore, a_xvt, a_xvt_post, a_obj, a_child, a_update, a_select, a_post, a_debug }; +HIDDEN void set_default_palette(WINDOW win) +{ + COLOR colori[12] = { MASK_BACK_COLOR, MASK_LIGHT_COLOR, MASK_DARK_COLOR, + NORMAL_COLOR, NORMAL_BACK_COLOR, + FOCUS_COLOR, FOCUS_BACK_COLOR, + DISABLED_COLOR, DISABLED_BACK_COLOR, + BTN_BACK_COLOR, BTN_LIGHT_COLOR, BTN_DARK_COLOR }; + + XVT_PALETTE wp = xvt_vobj_get_palet(win); + if (wp != NULL) + { + XVT_PALETTE up = xvt_palet_create(XVT_PALETTE_USER, NULL); + if (up != NULL) + { + xvt_palet_set_tolerance(up, xvt_palet_get_tolerance(wp)); + + const int MAXCOL = 256; + COLOR colors[MAXCOL]; + const int num = xvt_palet_get_colors(wp, colors, MAXCOL); + xvt_palet_add_colors(up, colors, num); + const int add = xvt_palet_add_colors(up, colori, 12); + if (add > 0) + { + xvt_vobj_set_palet(win, up); + xvt_palet_destroy(wp); + } + else + xvt_palet_destroy(up); + } + } +} + // @func Permette di cambiare i colori attivi del programma void customize_colors() @@ -229,6 +261,8 @@ void customize_colors() BTN_DARK_COLOR = colors.get_color("ButtonDark", NULL, -1, BTN_DARK_COLOR); aga_set_pref(AGA_PREF_BTN_COLOR_DARK, BTN_DARK_COLOR); + set_default_palette(TASK_WIN); + if (_picture) _picture->reload(); } @@ -354,6 +388,7 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, WINDOW win = xvt_win_create(wt, &r, (char*)caption, NULL, parent, wsf, EM_ALL, (EVENT_HANDLER)xi_event, (long)msk); CHECK(win, "Can't create an XVT window for an interface"); + set_default_palette(win); XI_OBJ_DEF* def = xi_create_itf_def(ITF_CID, xi_event_handler, &r, (char*)caption, (long)msk); CHECK(def, "Can't define an interface"); @@ -369,16 +404,6 @@ WINDOW create_interface(WINDOW parent, short x, short y, short dx, short dy, xi_dequeue(); xi_tree_free(def); - - COLOR colori[12] = { MASK_BACK_COLOR, MASK_LIGHT_COLOR, MASK_DARK_COLOR, - NORMAL_COLOR, NORMAL_BACK_COLOR, - FOCUS_COLOR, FOCUS_BACK_COLOR, - DISABLED_COLOR, DISABLED_BACK_COLOR, - BTN_BACK_COLOR, BTN_LIGHT_COLOR, BTN_DARK_COLOR }; - XVT_PALETTE pu = xvt_palet_create(XVT_PALETTE_USER, NULL); - xvt_palet_add_colors(pu, colori, 12); - xvt_vobj_set_palet(win, pu); - xvt_palet_destroy(pu); if (Y_FU_MULTIPLE == 0) { diff --git a/include/execp.cpp b/include/execp.cpp index 79ab39e04..6f30073d9 100755 --- a/include/execp.cpp +++ b/include/execp.cpp @@ -124,6 +124,7 @@ word TExternal_app::run( { tw.maximize(); tw.activate(); + xvt_app_process_pending_events(); } } xvt_statbar_refresh(); diff --git a/include/mask.cpp b/include/mask.cpp index da2bffd69..a4c733a09 100755 --- a/include/mask.cpp +++ b/include/mask.cpp @@ -284,13 +284,15 @@ int TMask::first_focus(short id) } TOperable_field& TMask::focus_field() const -{ - const short focus = get_focus_id(win()); - - if (focus > 0 ) - ((TMask *)this)->_focus = id2pos(focus); +{ + if (is_open()) + { + const short focus = get_focus_id(win()); + if (focus > 0 ) + ((TMask *)this)->_focus = id2pos(focus); + } + TMask_field & f = fld(_focus); - CHECK(f.is_kind_of(CLASS_OPERABLE_FIELD), "A non operable_field has the focus"); return (TOperable_field&)f; } diff --git a/include/msksheet.cpp b/include/msksheet.cpp index ed3740f9c..948bfc334 100755 --- a/include/msksheet.cpp +++ b/include/msksheet.cpp @@ -1072,7 +1072,10 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) copy_cell2field(); } else // edit_field - { + { + // Notifica il corretto campo col focus sulla maschera + sheet_mask().notify_focus_field(_edit_field->dlg()); + ok = _edit_field->on_key(k); if (!ok && k == K_F9) // Ricerca non completata? @@ -1091,7 +1094,9 @@ bool TSpreadsheet::event_handler(XI_OBJ* itf, XI_EVENT *xiev) { mask2str(_cur_rec); on_idle(); // Update immediately! - } + } + set_focus_cell(_cur_row, _cur_col); + _check_enabled = TRUE; // Re-enable checks } break;