how to fire blur event when keydown ?

1,095 views
Skip to first unread message

Luke

unread,
Jul 16, 2011, 11:48:20 AM7/16/11
to Google Web Toolkit
@UiHandler("textboxField")
public void keyDownSearchHandler(KeyDownEvent event){

//how to fire textboxField blur event after user press key
down?
}

Gal Dolber

unread,
Jul 16, 2011, 1:42:11 PM7/16/11
to google-we...@googlegroups.com
This is a hard one. If you are trying to do what I think you need to fire a "tab" event on the textbox, that will trigger the blur, and focus the next field.

// The code should look something like this
NativeEvent e = Document.get().createKeyDownEvent(....);
textboxField.getElement().dispatchEvent(e);


--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-tool...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.




--
Guit: Elegant, beautiful, modular and *production ready* gwt applications.

http://code.google.com/p/guit/




Gal Dolber

unread,
Jul 16, 2011, 1:43:00 PM7/16/11
to google-we...@googlegroups.com
If forgot to say: the keyDownEvent you create should have the KeyCodes.KEY_TAB key code

Abduxkur Ablimit

unread,
Jul 19, 2011, 9:25:29 PM7/19/11
to google-we...@googlegroups.com
@UiField
TextBox textboxField;

    @UiHandler("textboxField")
    public void keyDownSearchHandler(KeyDownEvent event){
        textboxField.fireEvent(new BlurEvent(){})
    }


From: Luke <trava...@gmail.com>
To: Google Web Toolkit <google-we...@googlegroups.com>
Sent: Saturday, July 16, 2011 11:48 PM
Subject: how to fire blur event when keydown ?
--
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-we...@googlegroups.com.
To unsubscribe from this group, send email to google-web-toolkit+unsub...@googlegroups.com.

Patrick Tucker

unread,
Jul 21, 2011, 9:11:36 AM7/21/11
to Google Web Toolkit
Why not set focus to false.
Reply all
Reply to author
Forward
0 new messages