PDA

View Full Version : [FIXED] GXT Beta 3 SVN Build - Events.KeyPress Bug



jtmille3
27 May 2008, 7:12 AM
code below never gets fired. It did with Beta 2 build. I don't know what's changed.

TextField<String> myTextField = new TextField<String>();
myTextField

.addListener(Events.KeyPress, new Listener() {
publicvoid handleEvent(BaseEvent be) {
}
});

jtmille3
27 May 2008, 8:42 AM
I applied a fix in my own build.

In Field.class line 699 onKeyPress(FieldEvent fe) is stubbed out. It's being called correctly by method onComponentEvent, the observable is just never getting fired. If you guys apply this fix, can you also add KeyUp, and KeyDown events and fill in those methods in the Field class?


protectedvoid onKeyPress(FieldEvent fe) {
fireEvent(Events.KeyPress, new FieldEvent(this));
}

darrellmeyer
27 May 2008, 10:34 AM
Field now uses a KeyNav and fires the KeyPress event. I added the event to the javadocs. KeyPress is a application event that normalizes the browser key events. You can listen for the browser key up and browser key down using the GWT Event class. Fix is in SVN.


// app event
field.addListener(Events.KeyPress, l);


// browser event
field.addListener(Event.ONKEYDOWN, l);
// any GXT that begins with "On" is a browser event
field.addListener(Events.OnKeyDown, l);