Hi Roman,

thanks for the help. But the listener is still not executed. I tried the things you described already (without adding the third parameter ,this). But that did not help. Do you have any other tipps ? When i click the button nothing happens.

Regards
-Tom

Am 18.01.2009 um 17:19 schrieb Roman Schmid:

Hi

You should always add the listener as reference to the function, like this:
this.loginListener

NOT: this.loginListener()
the second example will actually call the function and return the
functions return value which is clearly not what you want.

Other than that, i advise you to bind the function to "this" (to make
sure, the function execution takes place in the right context).
Like:
this.loginButton.addListener("execute", this.loginListener, this);
Notice the third parameter here.

Cheers
- Roman

Thomas Schober wrote:
Hi again :)

i try to make some sort of model, view , controler with a login window,
but i have a little problem.

In my Application.js i create an instance of my Controler like this :

var loginContrl = new firstapp.controler.loginControler();
loginContrl.showLogin();


The source of the Controler looks like :

qx.Class.define("firstapp.controler.loginControler",
{
 extend : qx.core.Object,



 construct : function()
 {
   this.loginWindow = new firstapp.ui.loginBox("LoginWindow",null);
 },







 members :
 {
   loginWindow : null,



   performLogin : function()
   {
       alert("blub");
   },



   showLogin : function()
   {
       this.loginWindow.open();
       this.loginWindow.addLoginListener(this.performLogin);
   }



 }



});

Additionally i have a loginWindow class, that looks like this :

/* ************************************************************************

  Copyright:

  License:

  Authors:

************************************************************************ */

/* ************************************************************************

#asset(firstapp/*)

************************************************************************ */

/**
* This is the main application class of your custom application "firstapp"
*/
qx.Class.define("firstapp.ui.loginBox",
{
 extend : qx.ui.window.Window,



 /*

*****************************************************************************
    MEMBERS

*****************************************************************************
 */
 construct : function(name,icon)
 {
   this.base(arguments,name,icon);
   this.set
   ({
       modal         : true,
       showMinimize  : false,
       showMaximize  : false,
       allowMaximize : false,
       allowClose    : false



   });



   this.addContent();
 },



 members :
 {



    loginButton   : null,
    loginListener : null,



   /**
* This method contains the initial application code and gets called
    * during startup of the application
    */
    addContent : function()
    {
       var windowLayout = new qx.ui.layout.VBox(10);
       this.setLayout(windowLayout);
       this.setMinWidth(300);
       var loginField = new qx.ui.form.TextField("Enter
Login").set({width: 260});
       var passField = new qx.ui.form.PasswordField("Enter
Passw").set({width : 260});
       loginButton = new qx.ui.form.Button("Login");
       this.add(loginField);
       this.add(passField);
       this.add(loginButton);
       this.addListenerOnce("resize", this.center, this);
    },



    addLoginListener : function (listener)
    {
       this.loginListener = listener;
       this.loginButton.addListener("execute",this.loginListener());

    }
 }
});

When the loginControler is instantiated, it creates an instance of the login window, registers a listener for the button and then it opens the
window. But the registered listener is not called, when i press the
button. Nothing happens ? Is it not allowed to hand over a function
pointer from another class as listener ?

Thank you
Tom


------------------------------------------------------------------------

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword


------------------------------------------------------------------------

_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to