Adds Event.ONINPUT (issue 4549). (issue1248801)

310 views
Skip to first unread message

Robert Staats

unread,
Dec 27, 2010, 2:08:14 PM12/27/10
to google-web-tool...@googlegroups.com
Reviewers: ,

Description:
I used Issue 51810 as my template for this
(http://gwt-code-reviews.appspot.com/51810).

I use sinkEvents to catch onPaste events to a TextBox so I can react to
changes on TextBoxes without waiting for it to loose focus. This works well
for IE and Firefox but Opera does not support onPaste.

Opera has an onInput event that provides a way to detect a TextBox change.
This patch allows the onInput event to be detected in GWT.

Please review this at http://gwt-code-reviews.appspot.com/1248801/show

Affected files:
user/src/com/google/gwt/user/client/Event.java
user/src/com/google/gwt/user/client/impl/DOMImpl.java
user/src/com/google/gwt/user/client/impl/DOMImplOpera.java
user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
user/src/com/google/gwt/user/client/impl/DOMImplTrident.java


Index: user/src/com/google/gwt/user/client/impl/DOMImpl.java
===================================================================
--- user/src/com/google/gwt/user/client/impl/DOMImpl.java (revision
9483)
+++ user/src/com/google/gwt/user/client/impl/DOMImpl.java (working
copy)
@@ -92,6 +92,7 @@
case "gesturestart": return 0x1000000;
case "gesturechange": return 0x2000000;
case "gestureend": return 0x4000000;
+ case "input": return 0x8000000;
default: return -1;
}
}-*/;
Index: user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
===================================================================
--- user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
(revision
9483)
+++ user/src/com/google/gwt/user/client/impl/DOMImplStandard.java
(working
copy)
@@ -271,6 +271,8 @@
@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :

null;
if (chMask & 0x4000000) elem.ongestureend = (bits & 0x4000000) ?
@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :

null;
+ if (chMask & 0x8000000) elem.oninput = (bits & 0x8000000) ?
+ @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :
null;
}-*/;

private native void releaseCaptureImpl(Element elem) /*-{
Index: user/src/com/google/gwt/user/client/impl/DOMImplOpera.java
===================================================================
--- user/src/com/google/gwt/user/client/impl/DOMImplOpera.java (revision
9483)
+++ user/src/com/google/gwt/user/client/impl/DOMImplOpera.java (working
copy)
@@ -68,5 +68,7 @@
@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :

null;
elem.onpaste = (bits & 0x80000) ?
@com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :

null;
+ elem.oninput = (bits & 0x8000000) ?
+ @com.google.gwt.user.client.impl.DOMImplStandard::dispatchEvent :
null;
}-*/;
}
Index: user/src/com/google/gwt/user/client/impl/DOMImplTrident.java
===================================================================
--- user/src/com/google/gwt/user/client/impl/DOMImplTrident.java
(revision
9483)
+++ user/src/com/google/gwt/user/client/impl/DOMImplTrident.java
(working
copy)
@@ -278,5 +278,7 @@

@com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null;
if (chMask & 0x80000) elem.onpaste = (bits & 0x80000) ?

@com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null;
+ if (chMask & 0x8000000) elem.oninput = (bits & 0x8000000) ?
+
@com.google.gwt.user.client.impl.DOMImplTrident::callDispatchEvent : null;
}-*/;
}
Index: user/src/com/google/gwt/user/client/Event.java
===================================================================
--- user/src/com/google/gwt/user/client/Event.java (revision 9483)
+++ user/src/com/google/gwt/user/client/Event.java (working copy)
@@ -272,6 +272,15 @@
*/
public static final int ONGESTURESTART = 0x1000000;

+ /**
+ * Fired when the contents of a textarea, input:text, input:password or
+ * input:search element have changed, because the onchange event on these
+ * elements fires when the element loses focus, not immediately after
the modification.
+ *
+ * Note: This event is <em>not</em> supported on Internet Explorer.
+ */
+ public static final int ONINPUT = 0x8000000;
+
/**
* Fired when the user depresses a key.
*/

warren lemmon

unread,
Apr 24, 2012, 10:33:27 AM4/24/12
to google-web-tool...@googlegroups.com
What is the resolution on adding oninput? It seems to have never made it into trunk...

Maciek Smolczewski

unread,
Jun 6, 2017, 10:49:28 AM6/6/17
to GWT Contributors, b...@staats.me
I'm trying to impement range input widget (slider) used in conjunction with textbox. I want the textbox to display value chosen by the slider while the mouse is dragging. This would be very easy if I could register on ONINPUT events. Unfortunately it's not an option currently..

Thomas Broyer

unread,
Jun 6, 2017, 10:58:54 AM6/6/17
to GWT Contributors
Related: https://groups.google.com/forum/#!topic/google-web-toolkit/k_o1fYjETY4 (tl;dr: it is possible, it just needs a bit more work on your part; JSNI or JsInterop/elemental2 are also an option)
Reply all
Reply to author
Forward
0 new messages