Project

General

Profile

WCombox, dbo models, and setNoSelectionEnabled

Added by Mark Petryk about 3 years ago

I am having an issue with WComboBox backed up by a model. I need to allow for 'no selection' but setting "setNoSelection(true)" does not seem to impact this widget, nor does it allow me to have 'no selection' in the combo box. The problem is worsened by, when 'tabbing' through the form, tabbing over the combo-box causes the first item to be selected, and then even if I don't want any item selected, I am unable to 'unselect' the now selected item.


Replies (3)

RE: WCombox, dbo models, and setNoSelectionEnabled - Added by Mark Petryk about 3 years ago

...however, and this is the strange part, the widget, though showing a selected item, is not actually selected. It appears to be selected, but does not appear to be updated, and therefore the 'apparently selected item' does not get saved. Real strange...

RE: WCombox, dbo models, and setNoSelectionEnabled - Added by Korneel Dumon about 3 years ago

Hi Mark,

The documentation of setNoSelectionEnabled() mentions that you cannot unselect after selection. I think for the behavior you want, you should add an empty element at the front of your model (somthing like "--- choose an option ---"). There is an example of this in the widget-gallery with a combo box for countries (see Forms > Integration example).

I tested tabbing through the form, but does not seem to select anything when I do it. Can you make an example to reproduce this?

Korneel

RE: WCombox, dbo models, and setNoSelectionEnabled - Added by Christian Meyer almost 3 years ago

Hi,

I would like to have an unselectable Placeholder as well.

I have a shared Model that I would like to keep clean, meaning not put a -- select option -- item into the model.

I use the Model once to select an Item to Modify with a Combobox, and once in a SelectionBox with Extended Selection to save these Items into a relation.

Would it be possible to add an Empty Element directly in the Widget? So the Model can still update but the Empty Element stays?

Like setPlaceholderElement(bool placeholder) and setPlaceholderText(WString title) ?

Would love to see that!
Cheers!

    (1-3/3)