Re: Trigger button on ENTER inside a TextBox?
Thanks Jens. Yes I use uibinder, did not know I can register more than one widget to the same handler method. Will go for this approach. 2013/3/14 K vfdsdfbsdb kazuoh...@gmail.com sure you must add keyListener for all TextBox . But if you create one method,it 's smart. example for private void addListeners(ListTextBox textboxs ,Listener listener){ for(int i=0;itextboxs.size;i++){ textboxs.get(i).addKeyListener(listener); } } 2013/03/14 7:02 membersound kodyreco...@gmail.com: Hi, I have a popup with a bunch of TextBox and TextArea fields. Also 3 Buttons like Save, Cancel, Reset. For the TextBoxes I would like to trigger the Save action if ENTER is hit while inside a TextBox (not for the TextAreas). Would I have to register a KeyDownHandler for all the TextBoxes (which would be lots of boilerplate code)? Or is there anything native in GWT catching ENTER key in TextBoxes? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to a topic in the Google Groups Google Web Toolkit group. To unsubscribe from this topic, visit https://groups.google.com/d/topic/google-web-toolkit/BmA4uaw5HEM/unsubscribe?hl=en . To unsubscribe from this group and all its topics, 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trigger button on ENTER inside a TextBox?
Do you use UiBinder for the DialogBox content widget? If so you can add more than one widget to @UiHandler: @UiHandler({box1, box2, box3}) void maybeTriggerSave(KeyUpEvent event) { //check for ENTER and trigger save } Without UiBinder the above is equivalent to: KeyUpHandler maybeTriggerSaveOnKeyUp = new KeyUpHanlder() { .. }; box1.addKeyUpHandler(maybeTriggerSaveOnKeyUp); box2.addKeyUpHandler(...) If you instantiate the TextBoxes yourself you could replace new TextBox() with createTextBox() and add the key handler inside that method. Alternatively you could listen for Key events on your content widget (addDomHandler()) of your DialogBox and then figure out if the event source was a TextBox and not a TextArea. -- J. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Re: Trigger button on ENTER inside a TextBox?
sure you must add keyListener for all TextBox . But if you create one method,it 's smart. example for private void addListeners(ListTextBox textboxs ,Listener listener){ for(int i=0;itextboxs.size;i++){ textboxs.get(i).addKeyListener(listener); } } 2013/03/14 7:02 membersound kodyreco...@gmail.com: Hi, I have a popup with a bunch of TextBox and TextArea fields. Also 3 Buttons like Save, Cancel, Reset. For the TextBoxes I would like to trigger the Save action if ENTER is hit while inside a TextBox (not for the TextAreas). Would I have to register a KeyDownHandler for all the TextBoxes (which would be lots of boilerplate code)? Or is there anything native in GWT catching ENTER key in TextBoxes? -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- 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?hl=en. For more options, visit https://groups.google.com/groups/opt_out.