On Sun, Jan 24, 2010 at 06:30, Stefan Meyer <devmanfromm...@gmx.de> wrote:

> Hello Derrell Lipman,
>
> anotehr  question. How do realize vars that you can access from all
> qoodoo classes?
>

Declare the variables in your Application class:

 qx.Class.define("custom.Application",
{
  extend  : qx.application.Standalone,

  members :
  {
    /** My global variable */
    bGlobal : true

    main : function()
    {
      // access to global variable from within this class using "this"
      this.bGlobal = false;
    }
  }
}

Then you can access that main application class using
qx.core.Init.getApplication() so in some other class, you can read  the
global like this:


 qx.Class.define("custom.SomeArbitraryClass",
{
  extend  : qx.core.Object,

  construct : function()
  {
    /** Access the global variable */
    if (qx.core.Init.getApplication().bGlobal)
    {
      alert("The global is TRUE");
    }
}

You could also have made that global be a property of the Application class:
 qx.Class.define("custom.Application",
{
  extend  : qx.application.Standalone,

  properties :
  {
    /** My global variable */
    global : true
    ...

in which case you'd reference it from the other class using the property's
getter:

  qx.core.Init.getApplicaiton().getGlobal()

Hope that helps.

Derrell
------------------------------------------------------------------------------
Throughout its 18-year history, RSA Conference consistently attracts the
world's best and brightest in the field, creating opportunities for Conference
attendees to learn about information security's most important issues through
interactions with peers, luminaries and emerging and established companies.
http://p.sf.net/sfu/rsaconf-dev2dev
_______________________________________________
qooxdoo-devel mailing list
qooxdoo-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to