Hi Christian,

take a look at the third parameter of "addEventListener". The third 
parameter defines the context in which the callback function is called. 
The special variable "this" inside of the callback is set to this 
context. By default the context is the event target so "this" in the 
event handler points to the button instance. You have to change your 
code like this:

addEventListener( "execute", this.searchBillings, this);

Best Fabian

> I'm trying to submit an small form either by clicking the submit 
> button or by hitting return when the cursor is in the textfield 
> (everyone should know this behaviour from forms in HTML).
>  
> The important parts of my code (it's within a class):
> // ...
>  
> construct : function() {
>  this.create();
> },
>  
> members: {
>  create : function() {
>   // creating the grid layout and so on...
>  
>   paneSearch_groupboxSearch_textfieldClient = new qx.ui.form.TextField;
>   with( paneSearch_groupboxSearch_textfieldClient ) {
>    setLiveUpdate( true );
>    addEventListener( "keyup", this.checkSubmitSearchBillings );
>   }
>   paneSearch_groupboxSearch_gridLayout.add( 
> paneSearch_groupboxSearch_textfieldClient, 1, 4 );
>  
>   paneSearch_groupboxSearch_buttonSearch = new 
> qx.ui.form.Button("Search");
>   with( paneSearch_groupboxSearch_buttonSearch ) {
>    addEventListener( "execute", this.searchBillings  );
>   }
>   paneSearch_groupboxSearch_gridLayout.add( 
> paneSearch_groupboxSearch_buttonSearch, 3, 4 );
>  
>   // adding elements to document...
>  },
>  
>  searchBillings : function() {
>   // do something
>  },
>  
>  checkSubmitSearchBillings : function( keyEvent ) {
>   if( keyEvent.getIdentifier()=="Enter" ) {
>    this.searchBillings();
>   }
>  }
> }
>  
> // destrcutor and closing the class
>  
> There are no error while loading the page but if I hit the return key 
> in the textfield, there is only the error message:
> ERROR: qx.event.handler.EventHandler[60]: Failed to dispatch key 
> event: TypeError - this.searchBillings is not a function
>  
> Clicking the button works fine and there is also no error if I use 
> "this.searchBillings" as event function for the textfield.
>  
> Anybody there with an idea and/or solution for this problem? I can't 
> find the problem. One solution might be to copy the code of 
> searchBillings into checkSubmitSearchBillings, but that's no good 
> programming as you might agree with me.
>  
> Best regards,
> Christian
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> qooxdoo-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>   


-- 
Fabian Jakobs
JavaScript Framework Developer

1&1 Internet AG
Brauerstraße 48
76135 Karlsruhe

Amtsgericht Montabaur HRB 6484

Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Andreas Gauger, 
Matthias Greve, Robert Hoffmann, Norbert Lang, Achim Weiss
Aufsichtsratsvorsitzender: Michael Scheeren


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to