On Fri, Jun 11, 2010 at 16:01, Fritz Zaucker <[email protected]> wrote:

> On Fri, 11 Jun 2010, Derrell Lipman wrote:
>
> > Instead of the above assignment to a local variable called win, assign it
> to
> > a variable of your application instance:
> >
> >  this.win = new qx.ui.window.Window("Acerca de...",
> > "resource/masterstore/dialog-apply.png");
> >
> > Then in main:
> >
> > btnAyuda.addListener("execute", function(e) {
> >>                win.open();
> >>      });
> >>
> >
> > instead of the above, you want to specify that the listener function is
> to
> > execute in the context of your application object by passing a 3rd
> parameter
> > to addListener, and then you can access this.win:
> >
> > btnAyuda.addListener("execute", function(e)
> > {
> >      this.win.open();
> > },
> > this);
> >
> > You should be all set then.
> >
> > Derrell
>
>
> Or you could add as last line to your createAboutBox() function the line
>
>        return win;
>
> and in main do
>
> var win = createAboutBox();
> win.open();
>
> Derrell, what are the pros/cons of this?
>

They both work well in this simple case. If the window will need to be
accessed by various methods, then assigning it as an instance variable
provides easy access to it from any method. If win were just returned, then
you'd need to pass it to each method which requires it.

Derrell
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate 
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the 
lucky parental unit.  See the prize list and enter to win: 
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to