DOM.eventPreventDefault() works! Thank you Behrooz! And i'll take a look at EventPreview but this is rather a one-time-thing so i think eventPreventDefault() is enough.
On 11 Feb., 11:59, Behrooz Nobakht <[email protected]> wrote: > I am not sure but this may help that after focusing on the element of the > text field, > > DOM.eventPreventDefault(DOM.eventGetCurrentEvent()); > > And, I believe a more elegant way would be to implement an EventPreview on > your module to handle this. > > On Wed, Feb 11, 2009 at 2:08 PM, alex.d <[email protected]>wrote: > > > > > I have a panel that has a textbox and a button. If the Tab-key is > > pressed on the Button, the focus should be set to the textfield > > instead of going to all other elements on the page. So i have > > following keyboardListener on the Button: > > > public void onKeyDown(final Widget sender, final char keyCode, final > > int modifiers) > > { > > if (keyCode == KEY_TAB) { > > myTextbox.setFocus(true); > > } > > > The problem is: after setting focus to the textfield, it(textbox) > > receives original Tab-Event and the focus goes to the Button(next > > Element). So the question is - how can i prevent the origianl event > > from executing? > > The only solution i came out with so far, is to set focus with a delay > > (in a Timer). Any ideas of a better one? > > > Thx in advance, > > --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
