Hi Nick,

why don't you simply use the methods, provided by the button, to get your click 
animation on the button?
The following example works in playground:

var button1 = new qx.ui.form.Button("First Button", 
"icon/22/apps/internet-web-browser.png");
var doc = this.getRoot();
doc.add(button1,
{
left : 100,
top  : 50
});

var tf = new qx.ui.form.TextField();
doc.add(tf,
{
left : 100,
top  : 0
});

button1.addListener("execute", function(e) {
alert("SEND!");
});

tf.addListener("keydown", function(event){
  var keyident = event.getKeyIdentifier();
  if (keyident == "Enter")
  {
    var target = event.getTarget();
    if(!(target instanceof qx.ui.form.TextArea))
    {
      event.stopPropagation();
      event.preventDefault();
      this.press();
      this.execute();
      this.release(); //maybe use a once timer for release if the animation 
fails
    }
  }
}, button1);


Regards,

Andreas

-----Ursprüngliche Nachricht-----
Von: Nick Glencross [mailto:nick.glencr...@gmail.com] 
Gesendet: Donnerstag, 30. Juli 2009 12:15
An: thomas.herchenroe...@1und1.de
Cc: qooxdoo Development
Betreff: Re: [qooxdoo-devel] Two questions: Enter in Textfield & 
Drag/Dropmodifier keys

Hello Thomas!

On Thu, Jul 30, 2009 at 9:59 AM, thron7<thomas.herchenroe...@1und1.de> wrote:

> Anyway, Fabian said you should at least add the following lines to your
> handler:
>
>        ...
>        this.focus();
>        var clone = event.clone();
>        clone.setBubbles(false);
>        this.dispatchEvent(clone);
>        ...
>
> It is necessary to clone the event, since the original event gets pooled
> and cannot (easily) be re-dispatched. And the event to dispatch has to
> have bubbles==false, otherwise the dispatcher will not handle it.

I kept my fingers crossed as I tried this, but unfortunately it now says:

'Cannot stop propagation on a non bubbling event: keydown: Called
assertTrue with 'false'' when calling method

It looks like the button wasn't going to let the event propagate anyway.

I did try just using the clone in conjunction with what I had (good
tip!), but then it still gives the original message (No dispatcher can
handle event of type keydown on qx.ui.form.Button).

Don't worry too much about it... it would have just been nice to have
the visual effect of the button being pressed on submit.

(Just to clarify, the original code example was registered with:

   field.addListener("keydown",  this.__keydownEnter, submit_button);

so 'this' is the button in the event handler)


Thanks again,

Nick

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to