diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index b18f1ccc..5ade4c67 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -558,6 +558,7 @@ By \a clicking on one header the list get \a reordered, first up, and then down /// Scrolls the view to the first or last item of a specified category void scroll(bool to_bottom, size_type cat_pos = ::nana::npos); + void scroll(bool to_bottom, const index_pair& pos); /// Appends a new column with a header text and the specified width at the end, and return it position size_type append_header(nana::string header_text, unsigned width = 120); diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 557871b4..31f28a13 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -2008,6 +2008,7 @@ namespace nana scroll.h.amount(header.pixels()); scroll.h.range(graph->width() - width); scroll.h.value(scroll.offset_x); + scroll.h.step(graph->text_extent_size(L"W").width); } if(scroll.v.empty() == false) @@ -4259,6 +4260,13 @@ namespace nana ess.update(); } + void listbox::scroll(bool to_bottom, const index_pair& pos) + { + auto & ess = _m_ess(); + ess.lister.scroll(pos, to_bottom); + ess.update(); + } + listbox::size_type listbox::append_header(nana::string text, unsigned width) { auto & ess = _m_ess();