Quirksmode.org is a good resource for this kind of thing.

Here's a test page for the "onpaste", "beforepaste", ... events:
http://www.quirksmode.org/dom/events/tests/cutcopypaste.html

Please consider, that this doesn't work on all browsers! You can find
a (not completely up-to-date) overview here:
http://www.quirksmode.org/dom/events/cutcopypaste.html

HTH
Chris

On Feb 10, 9:25 pm, Jim Douglas <[email protected]> wrote:
> Try it like this:
>
> package test.client;
>
> import com.google.gwt.core.client.EntryPoint;
> import com.google.gwt.core.client.GWT;
> import com.google.gwt.user.client.Event;
> import com.google.gwt.user.client.ui.Button;
> import com.google.gwt.user.client.ui.RootPanel;
> import com.google.gwt.user.client.ui.TextBox;
>
> public class Test implements EntryPoint
> {
>     public void onModuleLoad()
>     {
>         final Button sendButton = new Button("Send");
>         sendButton.setEnabled(false);
>         final TextBox nameField = new TextBox()
>         {
>             public void onBrowserEvent(Event event)
>             {
>                 GWT.log(event.getType(), null);
>             }
>         };
>         nameField.sinkEvents(0x7fffffff);
>         RootPanel.get("nameFieldContainer").add(nameField);
>         RootPanel.get("sendButtonContainer").add(sendButton);
>     }
>
> }
>
> You want the ONPASTE event:
>
> http://google-web-toolkit.googlecode.com/svn/javadoc/2.0/com/google/g...
>
> On Feb 10, 10:55 am, "seven.reeds" <[email protected]> wrote:
>
>
>
> > Ok, yikes.  I created the following tiny sample to try and find out
> > which events fire when.
>
> > I did have a handler for *every* possible TextBox event but the mouse
> > over and move events just flooded everything -- I removed those.
>
> > Now I load the test.  I select some text that is outside of the text
> > box and move the cursor to the text box.  I click in the textbox to
> > gain focus and the event flooding starts again.  I click to paste-in
> > the copied text and more event flooding happens but no text is
> > actually pasted.
>
> > I will keep pruning down on event handlers.
>
> > package test.client;
>
> > import com.google.gwt.core.client.EntryPoint;
> > import com.google.gwt.event.dom.client.BlurEvent;
> > import com.google.gwt.event.dom.client.BlurHandler;
> > import com.google.gwt.event.dom.client.ChangeEvent;
> > import com.google.gwt.event.dom.client.ChangeHandler;
> > import com.google.gwt.event.dom.client.ClickEvent;
> > import com.google.gwt.event.dom.client.ClickHandler;
> > import com.google.gwt.event.dom.client.FocusEvent;
> > import com.google.gwt.event.dom.client.FocusHandler;
> > import com.google.gwt.event.dom.client.KeyDownEvent;
> > import com.google.gwt.event.dom.client.KeyDownHandler;
> > import com.google.gwt.event.dom.client.KeyPressEvent;
> > import com.google.gwt.event.dom.client.KeyPressHandler;
> > import com.google.gwt.event.dom.client.KeyUpEvent;
> > import com.google.gwt.event.dom.client.KeyUpHandler;
> > import com.google.gwt.event.dom.client.MouseDownEvent;
> > import com.google.gwt.event.dom.client.MouseDownHandler;
> > import com.google.gwt.event.dom.client.MouseUpEvent;
> > import com.google.gwt.event.dom.client.MouseUpHandler;
> > import com.google.gwt.event.dom.client.MouseWheelEvent;
> > import com.google.gwt.event.dom.client.MouseWheelHandler;
> > import com.google.gwt.event.logical.shared.ValueChangeEvent;
> > import com.google.gwt.event.logical.shared.ValueChangeHandler;
> > import com.google.gwt.user.client.Window;
> > import com.google.gwt.user.client.ui.Button;
> > import com.google.gwt.user.client.ui.RootPanel;
> > import com.google.gwt.user.client.ui.TextBox;
>
> > public class Test implements EntryPoint {
> >         public void onModuleLoad() {
> >                 final Button sendButton = new Button("Send");
> >                 final TextBox nameField = new TextBox();
>
> >                 sendButton.setEnabled(false);
>
> >                 nameField.addBlurHandler(new BlurHandler(){
> >                         @Override
> >                         public void onBlur(BlurEvent event) {
> >                                 Window.alert(event.toDebugString());
> >                         }});
> >                 nameField.addChangeHandler(new ChangeHandler(){
>
> >                         @Override
> >                         public void onChange(ChangeEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addClickHandler(new ClickHandler(){
>
> >                         @Override
> >                         public void onClick(ClickEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addFocusHandler(new FocusHandler(){
>
> >                         @Override
> >                         public void onFocus(FocusEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addKeyDownHandler(new KeyDownHandler(){
>
> >                         @Override
> >                         public void onKeyDown(KeyDownEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addKeyPressHandler(new KeyPressHandler(){
>
> >                         @Override
> >                         public void onKeyPress(KeyPressEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addKeyUpHandler(new KeyUpHandler(){
>
> >                         @Override
> >                         public void onKeyUp(KeyUpEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addMouseDownHandler(new MouseDownHandler(){
>
> >                         @Override
> >                         public void onMouseDown(MouseDownEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addMouseUpHandler(new MouseUpHandler(){
>
> >                         @Override
> >                         public void onMouseUp(MouseUpEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addMouseWheelHandler(new MouseWheelHandler(){
>
> >                         @Override
> >                         public void onMouseWheel(MouseWheelEvent event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
> >                 nameField.addValueChangeHandler(new 
> > ValueChangeHandler<String>(){
>
> >                         @Override
> >                         public void onValueChange(ValueChangeEvent<String> 
> > event) {
> >                                 // TODO Auto-generated method stub
> >                                 Window.alert(event.toDebugString());
>
> >                         }});
>
> >                 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.

Reply via email to