Project

General

Profile

WSelectionBox multiple select not working?

Added by Martin Dyring-Andersen about 8 years ago

Hello,

I am having a hard time getting pre-selection of multiple items in WSelectionBox to work: no items are selected.

It seems that there is a more general problem, as using the example source code from the widget gallery exhibits same behaviour (tested in IE 11 and Opera 22).

Is this a bug or am I missing something obvious?

Example code below (from widget gallery):

@Wt::WContainerWidget *container = new Wt::WContainerWidget();

Wt::WSelectionBox *sb2 = new Wt::WSelectionBox(container);

sb2->addItem("Bacon");

sb2->addItem("Cheese");

sb2->addItem("Mushrooms");

sb2->addItem("Green peppers");

sb2->addItem("Ham");

sb2->addItem("Pepperoni");

sb2->addItem("Red peppers");

sb2->addItem("Turkey");

sb2->setSelectionMode(Wt::ExtendedSelection);

std::set selection; // By default select the items with index 1 and 4.

selection.insert(1); // Index 1 corresponds to the 2nd item.

selection.insert(4); // Index 4 corresponds to the 5th item.

sb2->setSelectedIndexes(selection);

@

Best regards,

Martin Dyring-Andersen


Replies (4)

RE: WSelectionBox multiple select not working? - Added by Alex V about 8 years ago

Hi Martin,

I could not reproduce this error on Ubuntu with wt 3.3.1 using firefox 24.

RE: WSelectionBox multiple select not working? - Added by Martin Dyring-Andersen about 8 years ago

Hi Alex,

Sorry forgot to mention I am on 3.3.3.

If you look at the WSelectionBox in the widget gallery (www.webtoolkit.eu), does it also look correct for you?

BR,

Martin

RE: WSelectionBox multiple select not working? - Added by Alex V about 8 years ago

Hi Martin,

The widget gallery example is not working correctly for me either.

looks like a regression.

RE: WSelectionBox multiple select not working? - Added by Martin Dyring-Andersen about 8 years ago

Just tested with 3.3.2 where it works flawlessly.

I'll file a bug report.

Thanks for testing on your side Alex.

BR,

Martin

    (1-4/4)