Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Autocomplete Combo
Autocomplete Combo [message #456234] Fri, 27 May 2005 02:45 Go to next message
J Aaron Farr is currently offline J Aaron FarrFriend
Messages: 18
Registered: July 2009
Junior Member
Hello.

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:

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...

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"?

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.

Thanks,

jaaron

[1] http://www.google.com/webhp?complete=1&hl=en
Re: Autocomplete Combo [message #456237 is a reply to message #456234] Fri, 27 May 2005 03:58 Go to previous messageGo to next message
Daniel Spiewak is currently offline Daniel SpiewakFriend
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.&nbsp; You're calling
the Combo#setItems(String[]) method within the body of your
ModifyListener.&nbsp; The ModifyListener is called whenever the Combo is
modified, even adding new items.&nbsp; When you set or add or remove the
items, the listener is called, and the whole process repeats.&nbsp; 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.&nbsp; 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).&nbsp; You can do a lot with a Table.&nbsp;
Then you can popup and pop-down your Shell with the proper items
whenever you need an auto complete.&nbsp; 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?&nbsp; I've tried
a couple of methods and haven't been able to get it right.&nbsp; 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.&nbsp; However, the popup remains hidden while
typing. &nbsp;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&amp;hl=en</a>
<br>
</blockquote>
</body>
</html>
Re: Autocomplete Combo [message #456241 is a reply to message #456237] Fri, 27 May 2005 11:54 Go to previous messageGo to next message
J Aaron Farr is currently offline J Aaron FarrFriend
Messages: 18
Registered: July 2009
Junior Member
Daniel Spiewak wrote:

> 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.

Thanks for the suggestion!

You wouldn't happen to know whereabouts in the JDT code the auto-assist
is, would you?

Thanks again,
jaaron
Re: Autocomplete Combo [message #456252 is a reply to message #456241] Fri, 27 May 2005 17:28 Go to previous message
Daniel Spiewak is currently offline Daniel SpiewakFriend
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">Unfortunately, I don't.&nbsp; However, I'm sure one of
the very bright people on the newsgroup for platform and jdt issues
probably does.&nbsp; I'd try there.<br>
<br>
Daniel<br>
</font><br>
J Aaron Farr wrote:
<blockquote cite="midd7721b$h8u$1@news.eclipse.org" type="cite">Daniel
Spiewak wrote:
<br>
<br>
<blockquote type="cite">IMHO, you should go the way of the
auto-assist in JDT.&nbsp; 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).&nbsp;
You can do a lot with a Table.&nbsp; Then you can popup and pop-down your
Shell with the proper items whenever you need an auto complete.&nbsp; Good
luck.
<br>
</blockquote>
<br>
Thanks for the suggestion!
<br>
<br>
You wouldn't happen to know whereabouts in the JDT code the auto-assist
is, would you?
<br>
<br>
Thanks again,
<br>
jaaron
<br>
</blockquote>
</body>
</html>
Previous Topic:How to CUT an image region
Next Topic:Browser does not display text or content
Goto Forum:
  


Current Time: Tue May 14 01:12:22 GMT 2024

Powered by FUDForum. Page generated in 0.03481 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top