From 585732a497dbbfbea0f1e30bbc571c2ad8ecb974 Mon Sep 17 00:00:00 2001 From: qPCR4vir Date: Sun, 26 Apr 2015 02:32:22 +0200 Subject: [PATCH] simpler code --- source/gui/widgets/listbox.cpp | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/source/gui/widgets/listbox.cpp b/source/gui/widgets/listbox.cpp index b2fdde1c..88f04699 100644 --- a/source/gui/widgets/listbox.cpp +++ b/source/gui/widgets/listbox.cpp @@ -351,19 +351,23 @@ namespace nana bool first{true}; for( size_type idx{}; idxvisible || ! exp_opt.only_visible_columns); - if(first) first=false; else head_str += exp_opt.sep; - head_str += col->text; + size_type index{exp_opt.columns_order[idx]}; + bool bad{true}; + for (auto&col:cont()) + if(col.index == index) + { + bad=false; + head_str += col.text; + break; + } + + if(bad) + throw std::out_of_range("Trying to export from a lisboxt an inexisting column"); } return head_str; }