fixes for the listbox bugs described in issue #472
This commit is contained in:
parent
d845a82dc4
commit
1b0ac10475
@ -2300,7 +2300,8 @@ namespace nana
|
|||||||
size_type count_of_exposed(bool with_rest) const
|
size_type count_of_exposed(bool with_rest) const
|
||||||
{
|
{
|
||||||
auto lister_s = this->content_view->view_area().height;
|
auto lister_s = this->content_view->view_area().height;
|
||||||
return (lister_s / item_height()) + (with_rest && (lister_s % item_height()) ? 1 : 0);
|
return (lister_s / item_height()) + (with_rest &&
|
||||||
|
listbox_ptr->scroll_operation()->visible(true) && (lister_s % item_height()) ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update(bool ignore_auto_draw = false) noexcept
|
void update(bool ignore_auto_draw = false) noexcept
|
||||||
@ -6062,7 +6063,15 @@ namespace nana
|
|||||||
|
|
||||||
auto listbox::last_visible() const -> index_pair
|
auto listbox::last_visible() const -> index_pair
|
||||||
{
|
{
|
||||||
return _m_ess().lister.advance(_m_ess().first_display(), static_cast<int>(_m_ess().count_of_exposed(true)));
|
if(!const_cast<listbox*>(this)->scroll_operation()->visible(true))
|
||||||
|
{
|
||||||
|
auto last_cat = size_categ()-1;
|
||||||
|
index_pair ip(last_cat, at(last_cat).size()-1);
|
||||||
|
if(last_cat == 0 && ip.item == npos) // if the listbox is empty
|
||||||
|
ip.cat = npos; // return empty index_pair
|
||||||
|
return ip;
|
||||||
|
}
|
||||||
|
return _m_ess().lister.advance(_m_ess().first_display(), static_cast<int>(_m_ess().count_of_exposed(true)-1));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto listbox::visibles() const -> index_pairs
|
auto listbox::visibles() const -> index_pairs
|
||||||
|
Loading…
x
Reference in New Issue
Block a user