You just need to write your code to keep track of the state. If data is in the text box and then it goes to delete then its changed and enable the buttons.
Its all in tracking the state of the contents. On Jul 20, 2:29 pm, Bakul <[email protected]> wrote: > I appreciate your quick replies. Suggested solution looks promising. > > However, my confusion is: > > What will happen if user select the content, that is already there by > mouse double click and press delete. > > As in this case, on load buttons are disabled, now user has selected > it through mouse and pressed delete button, so onKeyUp length is '0', > hence it will not enable the buttons even though there is a change in > value. > > I know thats its a rare case, but I am writing a framework related to > it for a large scale project. > > On Jul 20, 1:25 pm, Dalla <[email protected]> wrote: > > > > > Would probably look something like: > > > final TextBox text = new TextBox(); > > final Button button = new Button(); > > text.addKeyUpHandler(new KeyUpHandler() { > > public void onKeyUp(KeyUpEvent event) { > > if (text.getText().length() != 0) { > > button.setEnabled(true); > > } > > else { > > button.setEnabled(false); > > } > > } > > > }); > > > --Dallahttp://date-time.appspot.com/ > > > On 20 Juli, 18:48, Sean <[email protected]> wrote: > > > > You can put on a keyboard listener, and before you enable the Save > > > button, make sure there is text in the text box. textBox.getText > > > ().length>0 type of thing. > > > > On Jul 20, 12:26 pm, Bakul <[email protected]> wrote: > > > > > Hi, > > > > > I have added: > > > > > myTextbox.addChangeListener(new ChangeListener(){ > > > > public void onChange(Widget sender) { > > > > onEdit(); > > > > } > > > > }); > > > > > and onEdit() I am enablingSave/Applybutton. > > > > > Problem: > > > > ChangeListener() get fired when myTextbox loses the focus. So when a > > > > person start typing on myTextbox, he is done with entering data but > > > >save/applybutton is still not enabled as still focus is on myTextbox. > > > > > If I goes and add KeyBoardListener and try to handle it on onKeyDown > > > > (), for which keyCode I should fire onEdit() <which enablessave/apply > > > > button>. I mean it should not be enabled if person press up/down/left/ > > > > right arrow key or any function key or insert/delete key and many > > > > more. > > > > > Is there any known solution to handle this problem? > > > > > Thanks, > > > > Bakul.- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
