Re: How To Simulate KeyPress

2010-06-14 Thread Lex
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 =

Re: How To Simulate KeyPress

2010-06-14 Thread Sky
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,

Re: How To Simulate KeyPress

2010-06-14 Thread Se Hee Lee
Thanks for your input. Yes. I know such solution works, but since the order of the widget isn't consistent and changes every time the screen is rendered, I need to perform some calculation to figure out the next widget with higher tab index to get focus. I was hoping that by firing a key press

Re: How To Simulate KeyPress

2010-06-14 Thread Sky
I can understand that. I am going to hazard a guess that firing an event and setting the value of the keycode to the TAB key likely is only useful for any code that Handles such a keystroke... it won't actually invoke the Tab keypress event in and of itself. Course, this is just a guess, I don't

How To Simulate KeyPress

2010-05-04 Thread Daniel Simons
I am creating a mobile web app with GWT and have discovered that the TextBox.setFocus(true) method does not work in mobile Safari. I also tried using JSNI to directly call element.focus(), which also did not work. Looking at other potential work arounds, the textbox in my application that I

Re: How To Simulate KeyPress

2010-05-04 Thread Lukas Laag
It is possible to generate events programmatically in JavaScript. This page gives a good overview of the topic, including key events (look for 'Manually firing events'): http://www.howtocreate.co.uk/tutorials/javascript/domevents. I do not know if generating a tab event like this in a JSNI