From 5f2d283e22f264deb823b08c15d05d987335dc0b Mon Sep 17 00:00:00 2001 From: villa Date: Thu, 16 May 1996 09:24:04 +0000 Subject: [PATCH] Scelta iniziale per listbox, correzioni sheet git-svn-id: svn://10.65.10.50/trunk@2835 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- include/controls.cpp | 11 +++++++++++ include/sheet.cpp | 4 ++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/include/controls.cpp b/include/controls.cpp index e6183cc33..e355326f8 100755 --- a/include/controls.cpp +++ b/include/controls.cpp @@ -1547,12 +1547,23 @@ void TDropDownList::select(int i, bool force) void TDropDownList::select_by_initial(char c) { + int next = _selected < _values.items() - 1 ? _selected + 1 : 0; + int first = -1; for (int i = 0; i < _values.items(); i++) + if (toupper(*(_values.get(i))) == toupper(c)) + { + first = i; + break; + } + if (first == -1) return; + for (i = next; i < _values.items(); i++) if (toupper(*(_values.get(i))) == toupper(c)) { select(i); break; } + if (i == _values.items() && first > -1) + select(first); } void TDropDownList::select_by_ofs(int i) diff --git a/include/sheet.cpp b/include/sheet.cpp index 15f645247..af44e088e 100755 --- a/include/sheet.cpp +++ b/include/sheet.cpp @@ -299,7 +299,7 @@ void TSheet_control::update(long n) bool scroll_first = items() == 0; // || !owner().mask().is_running(); if (!scroll_first) { - int first, last; + int first = 0, last = 0; xi_get_visible_rows(_obj, &first, &last); n = handle[first]; scroll_first = n > items(); @@ -308,7 +308,7 @@ void TSheet_control::update(long n) if (scroll_first) xi_scroll(_obj, XI_SCROLL_FIRST); else - xi_scroll_rec(_obj, handle[first], NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); + xi_scroll_rec(_obj, n, NORMAL_COLOR, XI_ATR_ENABLED | XI_ATR_AUTOSELECT, 0); } }