Is there an easy way to replace the input box in the combox widget with a simple element?
For my combobox choices I use a label provider that builds a template with an image in front. If I try to use the same label provider for the combobox current value, I see the HTML tags of this template. This is caused by that the combobox widget uses an input box to view the current value.
This makes sense if you want to allow text editing in the widget. I do however want the user to select from one of the provided alternatives. In this selection, the icon used in the list follows its text, and it would make sense to use the icon to visually represent the current value of the combobox.
I've started to implement a custom cell implementation and an appearance, but I've run into problems related to the way the combobox widget is designed. The first problem is that it is not possible to pass in the appearance into the widget. I then tried to copy the code from the original combobox widget in order to make some changes to it, but run into problems with protected methods on the ViewData class.
I also have the image in the dropdown and would like it to be displayed in the input element. Haven't started to look into the code but wanted to do some research first but your post doesn't raise my hopes.
A new appearance can be passed into a ComboBoxCell constructor, and that cell used in building the ComboBox. There is no distinct appearance for the combo box, it just uses the TriggerFieldAppearance interface. I will look into adding constructor options in the ComboBox class itself, to avoid this extra set of steps.
There must be a custom appearance, since there is no way to draw an icon inside an html <input type="text" > element, at least without drawing it over top of part of it or next to it (like the trigger icon itself).
You might also look at how the SideErrorHandler resizes the widget it is owned by to draw an error icon next to a field - the same idea might be possible for ComboBox to avoid (or as part of?) building a new appearance.
thanks for your reply. I was busy with some other tasks in the meanwhile but I now I managed to get back to my ComboBox. It looks somewhat awkward since the image is outside of the styled combo box but for my purpose this is ok. This way I didn't even had to do any resizing.