Updated 2017-09-20 15:40:24 by bll

Combobox Enhancements edit

bll 2015-9-1

Problem 1. The standard combobox has a fixed width. This is not particularly useful for localized text. Some localized text may be much longer than the default and other text may be much shorter. This set of routines adjusts the width of the combobox to match the width of the longest value in the combobox. It also resolves the problem of text updates and forgetting to adjust the corresponding combobox width.

See; ComboBox megawidget with adjusted width

Problem 2. Comboboxes cannot return values associated with the labels. For example, you might want to return 1-12 for the labels January-December.

For localized text, it is much easier to return a standard value than to have to handle many different languages. For example, a simple yes/no drop down would be ja/nein in german, oui/non in french, etc. Having code that checks for every possible return value for every localized combobox would be insane. Reverse translating each combobox isn't as bad, but gets messy as the number of comboboxes grows.

An example from HTML: You can have:
   <option value="volvo">Volvo</option>

The display name 'Volvo' returns the value 'volvo'.

See: ComboBox megawidget - return associated values