Thanks Jaroslav.
I was not able to find a replacement for that deprecated Listener.

On Jun 14, 7:51 pm, Jaroslav Záruba <[email protected]> wrote:
> /**
>  * Event listener interface for keyboard events.
>  *
>  * @deprecated use {...@link com.google.gwt.event.dom.client.KeyDownHandler},
>  *             {...@link com.google.gwt.event.dom.client.KeyUpHandler} and/or
>  *             {...@link com.google.gwt.event.dom.client.KeyPressHandler}
> instead
>  */
> @Deprecated
> public interface KeyboardListener extends EventListener {
>
> cheers
>   JZ
>
>
>
> On Mon, Jun 14, 2010 at 2:00 PM, Rashmi <[email protected]> wrote:
> > I need to create a SuggestBox that will show all options on pressing
> > the Enter key.
> > I have written the following implementation, and it seems to be
> > working fine.
> > I would like someone to review my implementation and let me know if it
> > will cause problems in any particular scenario.
>
> > Also, the SuggestOracle to be passed to this SuggestBox should have
> > the default suggestions set, by calling the method
> > setDefaultSuggestions() on MultiWordSuggestOracle.  Any user of my
> > SuggestBox should be transparent to this fact. Hence I guess I will
> > need to wrap (or extend) MultiWordSuggestOracle to do the default
> > suggestions settings. Can you please recommend what will be a good way
> > of doing this?
>
> > public class SuggestBoxWithAllOptions extends SuggestBox implements
> > KeyPressHandler {
>
> >        public SuggestBoxWithAllOptions(MultiWordSuggestOracle oracle) {
> >                super(oracle);
>
> >                this.addKeyPressHandler(this);
>
> >        }
>
> >       �...@override
> >        public void onKeyPress(KeyPressEvent event) {
> >                char c = event.getCharCode();
> >                int i = this.getText().length();
> >        if (c == KeyboardListener.KEY_ENTER && i == 0) {
> >                /* Since the query string is null, the default suggestions
> > will get listed */
> >                this.showSuggestionList();
> >        }
>
> >        }
> > }
>
> > /* Code for initializing the SuggestBox */
> >                List<String> suggestions = new ArrayList<String>();
> >                suggestions.add("Tablet");
> >                suggestions.add("Capsule");
> >                MultiWordSuggestOracle myOracle = new
> > MultiWordSuggestOracle();
> >                myOracle.addAll(suggestions );
> >                myOracle.setDefaultSuggestionsFromText(suggestions);
>
> >                SuggestBox mySuggest = new
> > SuggestBoxWithAllOptions(myOracle);
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Google Web Toolkit" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<google-web-toolkit%2Bunsubs 
> > [email protected]>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-web-toolkit?hl=en.

Reply via email to