-
FEATURED COMPONENTS
First time here? Check out the FAQ!
Hello, I have a combobox with, say, one item "Fred". When I type "fr" it completes to "fred" which is OK, though I prefer "Fred". Then when I call combo.getSelectedItem() I get null. It seems "fr" matches "Fred" when autocompleting but "fred" does not match "Fred" when calling getSelectedItem(). I would think these should be consistent, no? (I've written a TypeConverter to get around it for now.)
Any comments?
/Daryl
Since Combobox is editable textbox, so I think the current behavior is OK.
For your issue, maybe it could provide a 'strict' feature to do auto-complete.
please post to feature request.
Hi Dastultz,
You can use the constraint property to be strict, and this feature has implemented before.
For example,
<zk> <zscript> String[] data = new String[30]; for(int j=0; j < data.length; ++j) { data = "Option "+j; } ListModel strset = new SimpleListModel(data); </zscript> <combobox id="list" width="200px" constraint="strict" model="${strset}"/> </zk>
You can also have a look at this article ListModel and Databinding Enhanced Combobox
constraint="strict" , hmm.... I almost forgot it. :p
Well, I thought I had it at strict, I do now, but maybe I didn't at the time. I'll take another look at it when I get a chance. I like the listmodel approach better, maybe I can get rid of my type converter then.
Thanks.
/Daryl
Asked: 2008-08-25 20:43:31 +0800
Seen: 609 times
Last updated: Aug 28 '08