Hi Daniel,

Thank you, your suggestion is very interesting.
About the reuse of objects, there is a way for reset to default all the
widget? i see in the api viewer different reset function, there is one
for revert to the init status the widget?

In another project i'm creating a parser that create objects from a
list, and put the unused object in another array, if i want to reuse
these objects, some time i see the old properties.
Regards
 Sp

Il giorno mar, 05/07/2011 alle 14.31 +0200, Daniel Wagner ha scritto:
> Hi Simone,
> 
> your code fails because when you destroy the Window, it destroys its 
> children, including the ColorSelector. Then on the second button press, 
> you're trying to add the disposed selector to the new Window which 
> causes the exception. So a quick fix would be to move the ColorSelector 
> instantiation into the "execute" listener callback function.
> 
> However, that would still create a new Window every time the button is 
> clicked, which is not what you want (and would be a bad idea since 
> creating objects is expensive). Instead, you could implement the 
> Singleton pattern. Your button listener would just look like this:
> 
>        button1.addListener("execute", function(e) {
>          this._getWindow().open();
>        }, this);
> 
> While _getWindow would be a new method that makes sure only one instance 
> is created:
> 
>      _getWindow : function()
>      {
>        if (!this.__window) {
>          var selector = new qx.ui.control.ColorSelector();
>          var window = this.__window = new qx.ui.window.Window();
>          window.setModal(true);
>          window.setLayout(new qx.ui.layout.Basic() );
>          window.add(selector);
>        }
>        return this.__window;
>      }
> 
> 
> Regards,
> Daniel
> 
> On 07/05/2011 01:44 PM, Simone Pandolfo wrote:
> > Hi all,
> >
> > i'm trying to have one signle istance of an object, i write a short
> > example:
> > http://tinyurl.com/67fx8hs
> >
> > inside a button listener i create an window object and add to it a
> > listener "beforeClose" to destroy it, but at the next "execute" of the
> > button the window don't be create again and throw an error.
> >
> > Uncaught TypeError: Cannot read property '__fn' of null
> >
> > I need this because i want hide all the other window, and after show
> > again, but if i don't destroy the object i see the window twice, the old
> > istance and the new one.
> >
> > what i wrong?
> >
> > Best Regards
> >   Sp
> >
> 
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security 
> threats, fraudulent activity, and more. Splunk takes this data and makes 
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
> 

-- 
Erreedi Srl
Tel. 06.7900639
Fax 06.79840900
e-mail: [email protected]
------------------------------


------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to