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; }