On Sat, Feb 13, 2010 at 10:38, [email protected] <
[email protected]> wrote:

> Hello,
>
> i want to make the  "getHome" function dynamic. How can i  add a  var
> for that?
> like
>
> func[0] = "getHome";
> func[1] = "getFeed";
>
> ....
>
> this is my  version
>
>
> button[nr].addListener("execute",job.system.Globals.classSystemModules.getHome,job.system.Globals.classSystemModules);
>
> i need something like
>
>
> button[nr].addListener("execute",job.system.Globals.classSystemModules.+func[0]+,job.system.Globals.classSystemModules);
>
> How can i do that?
>

Try this in the playground. It's one possible way to do it...

// Create a button
var button1 = new qx.ui.form.Button("First Button",
"icon/22/apps/internet-web-browser.png");

// Document is the application root
var doc = this.getRoot();

// Add button to document at fixed coordinates
doc.add(button1,
{
  left : 100,
  top  : 50
});

function myhome(arg)
{
  alert("myhome with arg " + arg);
}

function myfeed(arg)
{
  alert("myfeed with arg " + arg);
}

var funcSuffix = [ "home", "feed" ];
var functions =
    {
      home : myhome,
      feed : myfeed,
      index : 0
    };

// Add an event listener
button1.addListener("execute",
                    function(e) {
                      functions[funcSuffix[functions.index % 2]](functions.
index);
                      functions.index++;
                    },
                    this);
------------------------------------------------------------------------------
SOLARIS 10 is the OS for Data Centers - provides features such as DTrace,
Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW
http://p.sf.net/sfu/solaris-dev2dev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to