0

Combobox autocomplete case indifferent

asked 2008-08-25 20:43:31 +0800

dastultz gravatar image dastultz
797 9

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

delete flag offensive retag edit

5 Replies

Sort by ยป oldest newest

answered 2008-08-28 14:19:29 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

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.

link publish delete flag offensive edit

answered 2008-08-28 14:28:29 +0800

dastultz gravatar image dastultz
797 9

Done.

http://sourceforge.net/tracker/index.php?func=detail&aid=2080644&group_id=152762&atid=785194

link publish delete flag offensive edit

answered 2008-08-28 14:36:32 +0800

jumperchen gravatar image jumperchen
3909 2 8
http://jumperchen.blogspo... ZK Team

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

link publish delete flag offensive edit

answered 2008-08-28 14:39:38 +0800

dennis gravatar image dennis
3679 1 6
http://www.javaworld.com....

constraint="strict" , hmm.... I almost forgot it. :p

link publish delete flag offensive edit

answered 2008-08-28 16:34:32 +0800

dastultz gravatar image dastultz
797 9

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

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2008-08-25 20:43:31 +0800

Seen: 609 times

Last updated: Aug 28 '08

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More