diff --git a/src/gui/control/gallery_list.cpp b/src/gui/control/gallery_list.cpp index 2d00cdb9..4f036bb5 100644 --- a/src/gui/control/gallery_list.cpp +++ b/src/gui/control/gallery_list.cpp @@ -73,14 +73,14 @@ void GalleryList::select(size_t item, size_t subcolumn, bool event) { void GalleryList::update() { // ensure selection is visible - SubColumn col = subcolumns[active_subcolumn]; + /*SubColumn col = subcolumns[active_subcolumn]; if (col.selection != NO_SELECTION) { if (itemStart(col.selection) < visible_start) { scrollTo(itemStart(col.selection), false); } else if (itemEnd(col.selection) > visibleEnd()) { scrollTo(itemEnd(col.selection) + visible_start - visibleEnd(), false); } - } + }*/ updateScrollbar(); Refresh(false); InvalidateBestSize(); diff --git a/src/gui/control/native_look_editor.cpp b/src/gui/control/native_look_editor.cpp index 9b67338d..378c993c 100644 --- a/src/gui/control/native_look_editor.cpp +++ b/src/gui/control/native_look_editor.cpp @@ -85,7 +85,7 @@ void NativeLookEditor::resizeViewers() { y = y - vspace + margin; SetVirtualSize(w, (int)y); if (CanScroll(wxVERTICAL)) { - SetScrollbar(wxVERTICAL, 0, h, (int)y); + SetScrollbar(wxVERTICAL, cached_scroll, h, (int)y); } if (y >= h) { // Doesn't fit vertically, add scrollbar and resize @@ -127,10 +127,15 @@ void NativeLookEditor::onScroll(wxScrollWinEvent& ev) { y = y - page; } else if (ev.GetEventType() == wxEVT_SCROLLWIN_PAGEDOWN) { y = y + page; - } else if (ev.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK || - ev.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE) { + } else if (ev.GetEventType() == wxEVT_SCROLLWIN_THUMBTRACK) { y = ev.GetPosition(); + cached_thumb_pos = y; + } else if (ev.GetEventType() == wxEVT_SCROLLWIN_THUMBRELEASE) { + // THUMBRELEASE GetPosition() was giving the thumb's original position, *prior to* all the preceding THUMBTRACK events, + // not its position at time of release + y = cached_thumb_pos; } + scrollTo(wxVERTICAL, y); } } @@ -159,6 +164,7 @@ void NativeLookEditor::scrollTo(int direction, int pos) { pos = max(0, min(bottom, pos)); if (pos != y) { SetScrollPos(wxVERTICAL, pos); + cached_scroll = pos; // move child controls FOR_EACH(v, viewers) { @@ -168,6 +174,7 @@ void NativeLookEditor::scrollTo(int direction, int pos) { } // redraw onChange(); + Update(); } } diff --git a/src/gui/control/native_look_editor.hpp b/src/gui/control/native_look_editor.hpp index 55234581..109d736c 100644 --- a/src/gui/control/native_look_editor.hpp +++ b/src/gui/control/native_look_editor.hpp @@ -39,6 +39,9 @@ private: static const int label_margin = 10; int label_width; + int cached_thumb_pos = 0; + int cached_scroll = 0; + DECLARE_EVENT_TABLE(); void onSize(wxSizeEvent&);