From 1c729f1d9294ba555d09b72689971436bbc816a1 Mon Sep 17 00:00:00 2001 From: Leonardo Backes Vargas Date: Thu, 5 Nov 2015 23:59:27 -0200 Subject: [PATCH] Fix listbox for auto_draw+inline_factory+item_proxy::value. When calling templated append() overload on a shown listbox, auto_draw caused an early redraw, which issued the inline widget set() member function before the value() and value_ptr() were actually set. --- include/nana/gui/widgets/listbox.hpp | 4 ++++ source/gui/widgets/listbox.cpp | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/include/nana/gui/widgets/listbox.hpp b/include/nana/gui/widgets/listbox.hpp index 5ade4c67..06666cd1 100644 --- a/include/nana/gui/widgets/listbox.hpp +++ b/include/nana/gui/widgets/listbox.hpp @@ -368,6 +368,9 @@ namespace nana item_proxy iter{ ess_, index_pair(pos_, size() - 1) }; if (set_value) iter.value(std::forward(t)); + + update(); + return iter; } @@ -441,6 +444,7 @@ namespace nana essence_t* ess_{nullptr}; category_t* cat_{nullptr}; size_type pos_{0}; ///< Absolute position, not relative to display, and dont change during sort() + void update(); }; struct export_options diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index 31f28a13..fa502292 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -4188,7 +4188,6 @@ namespace nana auto & m = cat_->items.back(); m.bgcolor = wd->bgcolor(); m.fgcolor = wd->fgcolor(); - ess_->update(); } } @@ -4204,6 +4203,11 @@ namespace nana auto i = ess_->lister.get(pos_); cat_ = &(*i); } + + void cat_proxy::update() { + ess_->update(); + } + //class cat_proxy //end class cat_proxy