Thanks Ian!

Both solutions work, but I prefer the sinkEvents one, since it seems
more broadly applicable.

Thank you,

Greg

On Jan 5, 9:28 am, Ian Bambury <ianbamb...@gmail.com> wrote:
> Or, if you want to be fed keyup events when the FU has focus (or anyt other
> event you choose)
>
>         fu.sinkEvents(Event.ONKEYUP);
>         fu.addHandler(new KeyUpHandler()
>         {
>
>             @Override
>             public void onKeyUp(KeyUpEvent event)
>             {
>                 Window.alert("Hi!");
>             }
>         }, KeyUpEvent.getType());
>
> On 5 January 2011 15:20, Ian Bambury <ianbamb...@gmail.com> wrote:
>
>
>
> >         fu.addChangeHandler(new ChangeHandler()
> >         {
>
> >             @Override
> >             public void onChange(ChangeEvent event)
> >             {
> >                 button.setFocus(true);
> >             }
> >         });
>
> > would put the focus on the button - any good?
>
> > or there's always 'DOM.addEventPreview' - problem is, you probably want
> > enter to move your user from input area to input area.
> > firstname-lastname-fileuploadCV or something, rather than submit every time
> > the user presses enter.
>
> > Ian
>
> > On 5 January 2011 14:50, Greg Dougherty <dougherty.greg...@mayo.edu>wrote:
>
> >> Currently, I'm using a SubmitButton, and forcing the user to click on
> >> the button to have anything happen.
>
> >> I'd like for the user to be able to hit Enter, and have the button
> >> fire (IOW, I want it to behave like a real application, rather than
> >> like a web application).  Unfortunately, I can't find any way to catch
> >> key events in that form.
>
> >> I'm using Apache FileUpload, which essentially requires me to have the
> >> file as the last item in the form (file size is in the hundreds of MB,
> >> so I read it a line at a time and toss the line when I'm done with
> >> it.  FileUpload only lets you keep a reader for one form element at a
> >> time, so I can't get data for anything after the file).  This means
> >> the average user is going to fill in that field last.  Which means
> >> that if I want to support the Enter key, I need to be able to do it
> >> after the user has selected a file using the FileUpload.  But
> >> FileUpload doesn't generate Key events.
>
> >> So, WHO gets those KeyPress Events?
>
> >> Greg
>
> >> On Jan 5, 8:08 am, jaybose <onyeje.b...@gmail.com> wrote:
> >> > OK, what does the button do, at the moment?
>
> >> > Do you have your EnterButton's handler call submit() on the form?
> >> > If so, are you seeing any errors?
>
> >> > On Jan 4, 8:53 am, Greg Dougherty <dougherty.greg...@mayo.edu> wrote:
>
> >> > > Yes, but it doesn't do the upload when I hit Enter.  Which is what I'm
> >> > > trying to figure out how to get it to do.
>
> >> > > Greg
>
> >> > > On Jan 4, 8:20 am, jaybose <onyeje.b...@gmail.com> wrote:
>
> >> > > >http://gwt.google.com/samples/Showcase/Showcase.html#!CwFileUpload
>
> >> > > > Look at the source of the ShowCase example above.
> >> > > > The uploadButton it uses is not a SubmitButton either.
>
> >> > > > Just make sure the handler of your EnterButton submits the form.
>
> >> > > > On Jan 3, 8:57 am, Greg Dougherty <dougherty.greg...@mayo.edu>
> >> wrote:
>
> >> > > > > So, now that I have an EnterButton class, I'd like to use it. :-)
> >>  I
> >> > > > > have a form panel with a FileUpload.  I'd like to let the user
> >> select
> >> > > > > a file, then hit enter to fire the form submit button (which is an
> >> > > > > EnterButton, not a SubmitButton).
>
> >> > > > > Unfortunately, FileUpload does not have an addKeyPressHandler
> >> > > > > routine.  So, who gets any key events I generate while in the text
> >> > > > > field part of a FileUpload?  What is the call chain for events
> >> that
> >> > > > > aren't captured by the Widget where the event happens?
>
> >> > > > > Sorry if this is an FAQ, and in the docs.  I took a (quick) look,
> >> and
> >> > > > > couldn't find anything.  Please point me to the correct docs if it
> >> is
> >> > > > > in there.
>
> >> > > > > Thanks!
>
> >> > > > > Greg
>
> >> --
> >> 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<google-web-toolkit%2bunsubscr...@googlegroups.com>
> >> .
> >> For more options, visit this group at
> >>http://groups.google.com/group/google-web-toolkit?hl=en.

-- 
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.

Reply via email to