|
Re: Autocomplete Combo [message #456237 is a reply to message #456234] |
Fri, 27 May 2005 03:58 |
Daniel Spiewak Messages: 263 Registered: July 2009 |
Senior Member |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">I have no idea how to force your combo to 'popup',
however, I can tell you about your StackOverflowError. You're calling
the Combo#setItems(String[]) method within the body of your
ModifyListener. The ModifyListener is called whenever the Combo is
modified, even adding new items. When you set or add or remove the
items, the listener is called, and the whole process repeats. You'll
have to manually ensure some kind of checking to prevent this (i.e.
check a condition prior to executing your event handling code and thus
calling the Combo#setItems(String[]) method).<br>
<br>
IMHO, you should go the way of the auto-assist in JDT. I.E. create an
SWT.NO_TRIM | SWT.ON_TOP Shell with a Table as it's only widget (use
FillLayout and only add the Table). You can do a lot with a Table.
Then you can popup and pop-down your Shell with the proper items
whenever you need an auto complete. Good luck.<br>
<br>
Daniel<br>
</font><br>
J Aaron Farr wrote:
<blockquote cite="midd761r2$ha0$1@news.eclipse.org" type="cite">Hello.
<br>
<br>
Does anyone have a code snippet for an autocomplete combo? I've tried
a couple of methods and haven't been able to get it right. I seem to
have two issues:
<br>
<br>
1. If I try to do "combo.setItems()" in the body of my ModifyListener,
I get a java.lang.StackOverflowError, so I can only use the combo.add()
or combo.remove() methods but even then...
<br>
<br>
2. I want to be able to display the popup list as the user types into
the combo's text field. However, the popup remains hidden while
typing. Is there a way to force it to "popup"?
<br>
<br>
I'm looking for something like Google Suggest's [1] text box.
Ultimately I want to subclass CellEditor and add this feature to a
ComboBoxCellEditor.
<br>
<br>
Thanks,
<br>
<br>
jaaron
<br>
<br>
[1] <a class="moz-txt-link-freetext" href="http://www.google.com/webhp?complete=1&hl=en">http://www.google.com/webhp?complete=1&hl=en</a>
<br>
</blockquote>
</body>
</html>
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03435 seconds