changeValue event in htmlArea?

classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|

changeValue event in htmlArea?

Sascha Kimmel
Hello everybody,

qooxdoo is really wonderful and offers a multitude of features although
it is still some work to understand it fully.

I've been trying for days to find a kind of change event on the htmlArea
which allows me to prompt the user to save the changes to the document
when he leaves the document or window.

Is there any such event available?
Otherwise I would have to use a combination of keyup/keydown, onpaste
and drag/drop event listeners for that purpose.

Appreciate any help or info!

Thanks!

Regards,
Sascha Kimmel

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexander Steitz
Hi Sascha,

On Saturday 09 January 2010 19:04:16 Sascha Kimmel wrote:
> qooxdoo is really wonderful and offers a multitude of features although
> it is still some work to understand it fully.
Thanks for the kudos and don't hesitate to ask questions here on the
mailinglist or at StackOverflow.

> I've been trying for days to find a kind of change event on the htmlArea
> which allows me to prompt the user to save the changes to the document
> when he leaves the document or window.
>
> Is there any such event available?
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.

> Otherwise I would have to use a combination of keyup/keydown, onpaste
> and drag/drop event listeners for that purpose.
Another solution would be to save the content first and compare the content at
specific user actions (e.g. leaves the document). This would save you to listen
to every single event since you are only interested in changes at all and not
at the source of the change.

cheers,
  Alex

------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev 
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexei Vinidiktov

On Mon, Jan 11, 2010 at 3:23 PM, Alexander Steitz <[hidden email]> 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

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Thomas Herchenroeder
Have you tried other events, like 'keyup'?!

On 02/25/2013 04:37 PM, Alexei Vinidiktov wrote:

On Mon, Jan 11, 2010 at 3:23 PM, Alexander Steitz <[hidden email]> 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


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

John Spackman-3
In reply to this post by Alexei Vinidiktov
I've not used HtmlArea for a while but it might worth bearing in mind that it is implemented as an iframe and events go to the iframe, not to the main window – you might have to trap events on the iframe's document body.  In order for your sample to work, HtmlArea would have to be specifically trapping the event inside the iframe and firing a duplicate on the htmlArea object.

John

From: Alexei Vinidiktov <[hidden email]>
Reply-To: qooxdoo Development <[hidden email]>
Date: Monday, 25 February 2013 15:37
To: <[hidden email]>, qooxdoo Development <[hidden email]>
Subject: Re: [qooxdoo-devel] changeValue event in htmlArea?


On Mon, Jan 11, 2010 at 3:23 PM, Alexander Steitz <[hidden email]> 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
------------------------------------------------------------------------------ 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 [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexei Vinidiktov
In reply to this post by Thomas Herchenroeder
'keyup' doesn't seem to work either.


On Mon, Feb 25, 2013 at 11:36 PM, thron7 <[hidden email]> wrote:
Have you tried other events, like 'keyup'?!


On 02/25/2013 04:37 PM, Alexei Vinidiktov wrote:

On Mon, Jan 11, 2010 at 3:23 PM, Alexander Steitz <[hidden email]> 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


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel




--
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexei Vinidiktov
In reply to this post by John Spackman-3

On Mon, Feb 25, 2013 at 11:43 PM, John Spackman <[hidden email]> wrote:
I've not used HtmlArea for a while but it might worth bearing in mind that it is implemented as an iframe and events go to the iframe, not to the main window – you might have to trap events on the iframe's document body.  In order for your sample to work, HtmlArea would have to be specifically trapping the event inside the iframe and firing a duplicate on the htmlArea object.

How can I add an event listener on the iframe document of HtmlArea?

I've tried the following code, but got the error message "Uncaught TypeError: Cannot call method 'addEventListener' of null ":

var html_doc = htmlArea.getContentDocument();
html_doc.addEventListener("keypress", function(e) {
alert("key pressed!");
}, this);

And how do I fire duplicate events on the htmlArea object?

Thanks!


--
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

John Spackman-3
Qooxdoo delays creating DOM elements until it actually needs them, which means that the iframe may not exist at the time when you want to set the event listener.  Try something like;

htmlArea.addListenerOnce("appear", function(evt) {
  var html_doc = htmlArea.getContentDocument();
  [ … snip … ]
});

Once you're catching events from the iframe, it's probably best not to try and simulate the qooxdoo event system – events can bubble and events like keyboard events can vary subtly from browser to browser; Qooxdoo's event system is not trivial or easily modified and you could end up introducing some hard to find bugs.  

In my experience (albeit with TinyMCE, but it's the same principal) the best way forward is to treat the event handlers on your iframe's document as completely separate to the "normal" qooxdoo events and if necessary pass them on as higher level, Qooxdoo events - e.g. if you're trying to detect whether the user has modified the content, fire a changeModified rather than passing keyup/down around the system.  This lets you cater for browser differences, which is a big issue with online editors.

John

From: Alexei Vinidiktov <[hidden email]>
Reply-To: qooxdoo Development <[hidden email]>
Date: Tuesday, 26 February 2013 10:25
To: qooxdoo Development <[hidden email]>
Subject: Re: [qooxdoo-devel] changeValue event in htmlArea?


On Mon, Feb 25, 2013 at 11:43 PM, John Spackman <[hidden email]> wrote:
I've not used HtmlArea for a while but it might worth bearing in mind that it is implemented as an iframe and events go to the iframe, not to the main window – you might have to trap events on the iframe's document body.  In order for your sample to work, HtmlArea would have to be specifically trapping the event inside the iframe and firing a duplicate on the htmlArea object.

How can I add an event listener on the iframe document of HtmlArea?

I've tried the following code, but got the error message "Uncaught TypeError: Cannot call method 'addEventListener' of null ":

var html_doc = htmlArea.getContentDocument();
html_doc.addEventListener("keypress", function(e) {
alert("key pressed!");
}, this);

And how do I fire duplicate events on the htmlArea object?

Thanks!


--
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 [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexei Vinidiktov
Thanks, John.

I got key events working using your suggestion. I had to make it listen for the htmlArea "ready" event.

This is the code I used:

htmlArea.addListenerOnce("ready", function(evt) {
var html_doc = htmlArea.getContentDocument();
html_doc.addEventListener("keyup", function(e) {
notes_list.getSelection().getItem(0).setResult(htmlArea.getHtml());
});
});


On Tue, Feb 26, 2013 at 8:20 PM, John Spackman <[hidden email]> wrote:
Qooxdoo delays creating DOM elements until it actually needs them, which means that the iframe may not exist at the time when you want to set the event listener.  Try something like;

htmlArea.addListenerOnce("appear", function(evt) {
  var html_doc = htmlArea.getContentDocument();
  [ … snip … ]
});

Once you're catching events from the iframe, it's probably best not to try and simulate the qooxdoo event system – events can bubble and events like keyboard events can vary subtly from browser to browser; Qooxdoo's event system is not trivial or easily modified and you could end up introducing some hard to find bugs.  

In my experience (albeit with TinyMCE, but it's the same principal) the best way forward is to treat the event handlers on your iframe's document as completely separate to the "normal" qooxdoo events and if necessary pass them on as higher level, Qooxdoo events - e.g. if you're trying to detect whether the user has modified the content, fire a changeModified rather than passing keyup/down around the system.  This lets you cater for browser differences, which is a big issue with online editors.

John

From: Alexei Vinidiktov <[hidden email]>
Reply-To: qooxdoo Development <[hidden email]>
Date: Tuesday, 26 February 2013 10:25
To: qooxdoo Development <[hidden email]>

Subject: Re: [qooxdoo-devel] changeValue event in htmlArea?


On Mon, Feb 25, 2013 at 11:43 PM, John Spackman <[hidden email]> wrote:
I've not used HtmlArea for a while but it might worth bearing in mind that it is implemented as an iframe and events go to the iframe, not to the main window – you might have to trap events on the iframe's document body.  In order for your sample to work, HtmlArea would have to be specifically trapping the event inside the iframe and firing a duplicate on the htmlArea object.

How can I add an event listener on the iframe document of HtmlArea?

I've tried the following code, but got the error message "Uncaught TypeError: Cannot call method 'addEventListener' of null ":

var html_doc = htmlArea.getContentDocument();
html_doc.addEventListener("keypress", function(e) {
alert("key pressed!");
}, this);

And how do I fire duplicate events on the htmlArea object?

Thanks!


--
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 [hidden email] https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel




--
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexander Steitz
In reply to this post by Alexei Vinidiktov

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:[hidden email]]
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 <[hidden email]> 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:[hidden email]]
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexander Steitz
In reply to this post by Alexei Vinidiktov

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:[hidden email]]
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 <[hidden email]> 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:[hidden email]]
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: changeValue event in htmlArea?

Alexei Vinidiktov
Hi Alexander,

Your code seems to work fine for keyboard initiated copy-paste operations. Thanks.


On Wed, Feb 27, 2013 at 7:07 PM, Alexander Steitz <[hidden email]> wrote:

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:[hidden email]]

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 <[hidden email]> 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:[hidden email]]
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 <[hidden email]> 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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel




--
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
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel