WComboBox doesn't honour "invalid" selection
When setting invalid index for a WComboBox programmatically, the first item in combo box will be displayed as selected instead.
Wt::WComboBox *combo = new Wt::WComboBox(this); combo->addItem("Apples"); combo->addItem("Oranges"); combo->setCurrentIndex(-1); // ERROR: it will display "Apples" instead of an blank field
Please find attached a patch proposal; it works fine for me, but Wt team might want to tweak it to make it more efficient.
Updated by Koen Deforche over 8 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
- Target version set to 3.3.3
I've made a change so that setting currentIndex to --1 works properly now.
Thanks for pointing this out.