Lex, here's a thought: can you determine which Widget or DOM element
that you want to gain focus when the user hits ENTER? If you can,
don't bother creating that event, just talk directly to the widget or
the DOM element through JSNI and give it focus. I don't know why your
solution doesn't work, but I think setting the focus on something is
the better approach. Not sure though for your specific situation.

gl

On Jun 14, 3:13 pm, Lex <tose...@gmail.com> wrote:
> I have a question related to this.
>
> I have a KeyPressHandler in the TextBox. When the user presses
> "Enter", I want to simulate it as "Tab".
>
> I have added the necessary code to capture the 'Enter" event, and then
> I fire the new event using the DomEvent.fireNativeEvent.
>
> NativeEvent tabEvent = Document.get().createKeyPressEvent(false,
> false, false, false, 9, 9);
> DomEvent.fireNativeEvent(tabEvent, textBox);
>
> What I am hoping to see is the 'tabbing' of the current cursor to the
> next Focusable widget, but it doesn't seem to happen.
>
> What am I missing?
>
> It basically re-enteres the KeyPressHandler since this is the widget
> that is being fired. In short, I need the way to suppress the current
> KeyPressHandler and have the Browser level KeyPressHandler of the
> 'tabbing' to occur.
>
> Any help is appreciated.
>
> Regards
>
> On May 5, 11:01 am, Thomas Broyer <t.bro...@gmail.com> wrote:
>
>
>
> > On May 4, 9:43 pm, Lukas Laag <laa...@gmail.com> wrote:
>
> > > It is possible to generate events programmatically in JavaScript. This
> > > page gives a good overview of the topic, includingkeyevents (look
> > > for 'Manually firing events'):
>
> > >http://www.howtocreate.co.uk/tutorials/javascript/domevents.
>
> > > I do not know if generating atabevent like this in a JSNI method
>
> > you actually don't need JSNI: just use Document.get().createXxxEvent()
> > and DomEvent.fireNativeEvent().
>
> > > would solve your focus problem.
>
> > I doubt it would, otherwise people would have proposed it as a
> > workaround:http://stackoverflow.com/questions/2398528/set-textbox-focus-in-mobil...
>
> > (note: according to "the web", it's a bug in WebKit)
>
> > --
> > 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 
> > athttp://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