nameField.sinkEvents(Event.ONPASTE); On Feb 10, 1:21 pm, Seven Reeds <[email protected]> wrote: > My understanding is faulty. > > The "final" keword gave me grief so I moved the button and textbox > definitions "outside". I am only seeing "change" BrowserEvents being > triggered. I am using GWT 2.0, eclipse 3.5 with the GWT plugin. I am > on the most recent or a very recent Ubuntu box and am displaying this > test in a firefox 3.5.7 browser. > > So, the app starts with an empty textbox and disabled button. I use > the mouse to select some text and then either I: > > - move the mouse to the textbox and just paste or > > - move the mouse to the textbox, click the textbox and then paste > > In either case onBrowserEvent is not triggered... as far as I can tell. > > After the paste, if I click outside the textbox then I get a "change" > event alert message from onBrowserEvent. > > The new test is: > > public class Test implements EntryPoint { > > Button sendButton = new Button("Send"); > TextBox nameField = null; > > public void onModuleLoad() { > nameField = new TextBox() { > public void onBrowserEvent(Event event) > { > Window.alert(event.getType()); > if (event.getTypeInt() == Event.ONPASTE) { > if (nameField.getValue().equals("")) { > sendButton.setEnabled(false); > } else { > sendButton.setEnabled(true); > } > } > } > }; > > sendButton.setEnabled(false); > > nameField.addChangeHandler(new ChangeHandler(){ > @Override > public void onChange(ChangeEvent event) { > if (nameField.getValue().equals("")) { > sendButton.setEnabled(false); > } else { > sendButton.setEnabled(true); > } > } > }); > > RootPanel.get("nameFieldContainer").add(nameField); > RootPanel.get("sendButtonContainer").add(sendButton); > } > > > > }
-- 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.
