Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
Hi there! If I select an option in the SuggestBox popup by pressing the enter key then onKeyUp event fire. But I don't want that it happens because I already handle pressing the enter on the textbox by executing another code. My code below: suggestBox.addSelectionHandler(new SelectionHandler() { public void onSelection(SelectionEvent arg0) { //Here my code } }); suggestBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { public void onKeyUp(KeyUpEvent arg0) { if (arg0.getNativeKeyCode() == 13) { //Here another my code } } }); How to disable this or what is the workaround? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
Can you check following whether it is what you need? If yes, I will post our solution here. On Dec 22, 6:35 am, "ss.require" wrote: > Hi there! > If I select an option in the SuggestBox popup by pressing the enter > key then onKeyUp event fire. But I don't want that it happens because > I already handle pressing the enter on the textbox by executing > another code. My code below: > > suggestBox.addSelectionHandler(new SelectionHandler() { > public void onSelection(SelectionEvent > arg0) { > //Here my code > } > }); > suggestBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { > public void onKeyUp(KeyUpEvent arg0) { > if (arg0.getNativeKeyCode() == 13) { > //Here another my > code > } > } > }); > > How to disable this or what is the workaround? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
I had the same requirement and ended up writing my own SuggestBox ( started from the code of gwt suggestbox ). -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
Have you tried checking isSuggestionListShowing() of the SuggestBox in the KeyUpHandler. If the method returns true You could skip processing the event. I haven't tried it but it could work. On Dec 22, 12:35 pm, "ss.require" wrote: > Hi there! > If I select an option in the SuggestBox popup by pressing the enter > key then onKeyUp event fire. But I don't want that it happens because > I already handle pressing the enter on the textbox by executing > another code. My code below: > > suggestBox.addSelectionHandler(new SelectionHandler() { > public void onSelection(SelectionEvent > arg0) { > //Here my code > } > }); > suggestBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { > public void onKeyUp(KeyUpEvent arg0) { > if (arg0.getNativeKeyCode() == 13) { > //Here another my > code > } > } > }); > > How to disable this or what is the workaround? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
Forget to attach url: http://www.holidayinn.com/hotels/us/en/home See whether it is what you need. On Dec 23, 11:49 am, Michael W wrote: > Can you check following whether it is what you need? > If yes, I will post our solution here. > > On Dec 22, 6:35 am, "ss.require" wrote: > > > Hi there! > > If I select an option in the SuggestBox popup by pressing the enter > > key then onKeyUp event fire. But I don't want that it happens because > > I already handle pressing the enter on the textbox by executing > > another code. My code below: > > > suggestBox.addSelectionHandler(new SelectionHandler() { > > public void onSelection(SelectionEvent > > arg0) { > > //Here my code > > } > > }); > > suggestBox.getTextBox().addKeyUpHandler(new KeyUpHandler() { > > public void onKeyUp(KeyUpEvent arg0) { > > if (arg0.getNativeKeyCode() == 13) { > > //Here another my > > code > > } > > } > > }); > > > How to disable this or what is the workaround? -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
Re: Pressing the enter key in the SuggestBox popup fire onKeyUp event! How to disable this?
> > As @Stole mentioned, use isSuggestionListShowing() of the SuggestBox in > KeyDownHandler instead of KeyUpHandler and move your existing from KeyUp to > KeyDowm. Because onSelection will trigger before onKeyUp but after > onKeyDown > mySuggestBoxObject.addKeyDownHandler(new KeyDownHandler() { @Override public void onKeyDown(KeyDownEvent event) { int key = event.getNativeEvent().getKeyCode(); if (mySuggestBoxObject.isSuggestionListShowing() && key == KeyCodes.KEY_ENTER) { event.getNativeEvent().preventDefault(); } } }); -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscr...@googlegroups.com. To post to this group, send email to google-web-toolkit@googlegroups.com. Visit this group at http://groups.google.com/group/google-web-toolkit. For more options, visit https://groups.google.com/d/optout.