tags:

views:

31

answers:

2

Hi Everyone!

I have a SWT combo box which has items more than 100.

For more efficient selecting, I want to add filter on combo box.

I have searched for this, but I cannot find appropriate comments.

Please let me know what is the best way for this.

Thanks.

A: 

As far as I know, SWT uses a simple model of adding an array of Strings as items using the setItems() method, but does not allow filtering like the JFace viewers.

So I think, the only solution is to filter the elements either before adding it using the setItems(), or using the add()/remove() methods (either based on indexing or Strings).

Zoltán Ujhelyi
Thanks for your response. I had resolved using JFace Viewer and Filter. But I think your solution also good. Thanks again.
cnook
A: 

I know it's not pure SWT, but if JFace is okay I find ComvoViewer API gives me the appropriate points, allowing me to to implement my filters. See the ContentProvider API, and specifically the inputChanged lifecycle.

arcticpenguin
Thanks a lot. I had resolved using JFace Viewer and Filter. I add a filter to the viewer not content provider. It works fine. Thanks again.
cnook