On Fri, 11 Jun 2010, Derrell Lipman wrote:

> 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.

Makes sense. Thanks,
Fritz

-- 
Oetiker+Partner AG              tel: +41 62 775 9903 (direct)
Fritz Zaucker                        +41 62 775 9900 (switch board)
Aarweg 15                            +41 79 675 0630 (mobile)
CH-4600 Olten                   fax: +41 62 775 9905
Schweiz                         web: www.oetiker.ch

------------------------------------------------------------------------------
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