Thank you Alex!

This was the hint I needed. I did the following assuming that "this" is the qx.ui.window.Window:

  this._okbutton = new qx.ui.form.Button('Login');
  this._okbutton.set({right:10,bottom:10});

  this.addEventListener("keydown", function(event) {
    if( event.getKeyCode()==13){
      event.stopPropagation();
      this._okbutton.dispatchEvent(event);
    }
  });
  this.addEventListener("keyup", function(event) {
    if( event.getKeyCode()==13){
      event.stopPropagation();
      this._okbutton.dispatchEvent(event);
    }
  });
 
  this.add(this._okbutton);


So we have to catch the "keydown" and "keyup" event and filter the "enter" key. Then we stop the propagation of the event (to avoid recursive triggering of the event) and call the dispatchEvent method of the button with the current event object.

This way we also have the visual response of the button showing that he has been activated.

The same methodology can be done by catching the "escape" key to activate the "cancel" button.

Alex D. schrieb:
Hi Dietrich,

i think you will have to attach eventlistener to the window(responding 
to enter or space) and then call your button-onpress routine.

Cheers,
alex.d
  
Hello List!

I have a modal qx.ui.window.Window wich contains a qx.ui.form.Button. I 
would like to attach an eventhandler which reacts on the return or enter 
key without having to focus the button.

How can I do this?

In pre namespace times there was the possibility to attach a QxCommand 
to a QxButton.

Thank you for your answers.

Best regards...

  
    

-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
  

-- 
Mit freundlichen Grüßen
Dietrich Streifert
Visionet GmbH
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to