On Fri, 11 Jun 2010, Derrell Lipman wrote:
> On Fri, Jun 11, 2010 at 15:47, ulr00t <[email protected]> wrote:
>
>>
>> Hello, first of all, thanks to whoever made this a wonderful project to
>> work
>> on :)
>>
>> My problem is the following one:
>>
>> I want to open a window I've created outside of "main" (the reason is that
>> I'd like to not overload "main" and I'd like to organize better the code),
>> but not yet, just create it.
>> See how is it:
>>
>> createAboutBox : function()
>> {
>> var win = new qx.ui.window.Window("Acerca de...",
>> "resource/masterstore/dialog-apply.png");
>>
>
> 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?
Cheers,
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