Hi Alexei,
you can use the "paste", "cut" and "copy" events for that.
-> https://developer.mozilla.org/en-US/docs/DOM/element.onpaste
Just replace "keypress" with e.g. "paste" and you get notified whenever a
paste is done.
--snip--
qx.bom.Event.addNativeListener(bodyElement, "paste", function(e) {
console.debug(e);
});
--snip-
I tested it for Firefox and IE7.
Regards,
Alex
From: Alexei Vinidiktov [mailto:[email protected]]
Sent: Wednesday, February 27, 2013 2:49 AM
To: Alexander Steitz
Subject: Re: [qooxdoo-devel] changeValue event in htmlArea?
Hi, Alexander,
Thanks for your help. Your code snippet seems to work fine.
I don't currently need to know which keys were pressed, but I'm sure it'll come
in handy later on.
What I'm really trying to do is capture any changes to my htmlArea. That
includes key presses, copy, cut and paste operations and any other events that
change the contents of the htmlArea.
As the original thread starter I need a changeValue event for htmlArea, but as
there seems to be none I'm trying other ways to achieve the same result.
Now I need to capture copy, cut and paste operations. How can I do that?
Or maybe there is a simpler way other than to listen for all those kinds of
events?
On Tue, Feb 26, 2013 at 11:43 PM, Alexander Steitz
<[email protected]<mailto:[email protected]>> wrote:
Hi Alexei,
getting the HtmlArea to work with "keypress" events is a bit tricky since the
HtmlArea uses internally a editable iframe object. But nevertheless with the
code sample below it should work:
--snip--
var bodyElement = yourHtmlAreaInstance.getContentBody();
var KeyBoard = qx.event.util.Keyboard;
qx.bom.Event.addNativeListener(bodyElement, "keypress", function(e) {
console.debug(Keyboard.charCodeToIdentifier(e.charCode));
});
--snip--
I've used the keyboard util class in order to not have to deal with charCode /
keyCode. This little helper is very powerful since it does normalize the key
identifier across all major browsers. And since we are dealing with DOM element
the native listener method is the way to go.
Hope that solves your issue.
Regards,
Alex
From: Alexei Vinidiktov
[mailto:[email protected]<mailto:[email protected]>]
Sent: Monday, February 25, 2013 4:38 PM
To: Alexander Steitz; qooxdoo Development
Subject: Re: [qooxdoo-devel] changeValue event in htmlArea?
On Mon, Jan 11, 2010 at 3:23 PM, Alexander Steitz
<[email protected]<mailto:[email protected]>> wrote:
Unfortunately not. You have to use event listeners to check for any changes.
Feel free to open a bug report for this feature if you like to see it in the
future.
How do I add a keypress event listener to HtmlArea?
This didn't work:
htmlArea.addListener("keypress", function(e) {
alert("key pressed!");
}, this);
--
Alexei Vinidiktov
--
Alexei Vinidiktov
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_d2d_feb
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel