Friday, October 24, 2014

Re: Send event for keydown

This is what is now did But it feels off :-(

Op donderdag 23 oktober 2014 16:34:15 UTC+2 schreef Thad Humphries:
This KeyPressHandler will change the text to upper case as the user types:

public class ForceUpperCase implements KeyPressHandler {
  @Override
  public void onKeyPress(KeyPressEvent event) {
    final TextBoxBase tbb = (TextBoxBase) event.getSource();
    Scheduler.get().scheduleDeferred(new Scheduler.ScheduledCommand() {
       @Override
       public void execute() {
           tbb.setText(tbb.getText().toUpperCase());
       }
    });
  }
}

..

textBoxBase.addKeyPressHandler(new ForceUpperCase());


On Tuesday, October 21, 2014 7:49:57 AM UTC-4, Marteijn Nouwens wrote:
In a sub class for a textbox i try to convert lower case to upper case. This works ok but i would like to send the upper case as a Event.

// NativeEvent down = Document.get().createKeyDownEvent(false, false, true, false, keyCode);
// DomEvent.fireNativeEvent(down, this, this.getElement());

But this does not seem to trigger the browser event.

Now i do substring and set value. The user does not see this but i feel it's a bit overkill.

Anybody any ideas.?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment