Hey,

in general, thats totally ok to pass classes around. Were in JavaScript here so 
thats working pretty well. ;) 
One thing you have to keep in mind is that the user of your window can not 
control and change the constructor  parameter. But if thats ok for you right 
now and in the future, there is no reason not to do so.
Best,
Martin

Am 10.04.2011 um 00:18 schrieb Marco Pompili:

> Hi qooxdooers,
> 
> I'm making a widget that is composed by a window and a form and two default
> buttons "close" and "submit".
> 
> This is the constructor of the WindowForm widget i'm implementing.
> 
> construct : function(form, renderer)
> {
>                // Set the window layout
>               this.setLayout(new qx.ui.layout.Canvas());
>               
>               // Center the window on opening
>               this.addListener("appear", this.center, this);
>               
>               // Set the form
>               this._form = form;
>               this._renderer = renderer;
>               
>               // Reset the form on close event
>               this.addListener("close", form.reset, form);
>               
>               // Init the controller
>               this._ctrl = new qx.data.controller.Form(null, form);
>               
>               // Init the model
>               this._model = this._ctrl.createModel();
>               
>               // Close button
>               this._closeBtn = new qx.ui.form.Button(this.getCloseLabel(),
> "icon/16/actions/dialog-close.png");
>               this._closeBtn.addListener("execute", this.close, this);
>               form.addButton(this._closeBtn);
>               
>               // Submit buttom
>               this._submitBtn = new qx.ui.form.Button(this.getSubmitLabel(),
> "icon/16/actions/dialog-apply.png");
>               this._submitBtn.addListener("execute", function()
>               {
>                       this.fireDataEvent("submit", this._model);
>                       this.close();
>                       
>               }, this);
>               form.addButton(this._submitBtn);
>               
>                //--------Rendering and adding the form in the
> window--------
>               // Render and add the form
>               if(renderer)
>                       this.add(new renderer(form), { edge : 0 });
>               else
>                       this.add(new qx.ui.form.renderer.Single(form), { edge : 
> 0 });
> 
> //------------------------------------------------------------------------------
> }
> 
> To set the renderer i must pass as parameter for the "renderer variable" a
> Class, so an instance for this class would be:
> 
> var myWF = new mx.ui.WindowForm(form, mx.form.renderer.MultiSide);
> 
> Everything is working fine, but I don't know if it is a good thing do or not
> to pass a class as I'm doing. Or if i can do this in another way.
> 
> I have to do this in another way ? What you think ?
> 
> Thank you for your time!
> 
> -----
> La coincidenza non ha madre.
> --
> View this message in context: 
> http://qooxdoo.678.n2.nabble.com/Passing-a-class-non-instance-in-the-constructor-tp6257825p6257825.html
> Sent from the qooxdoo mailing list archive at Nabble.com.
> 
> ------------------------------------------------------------------------------
> Xperia(TM) PLAY
> It's a major breakthrough. An authentic gaming
> smartphone on the nation's most reliable network.
> And it wants your games.
> http://p.sf.net/sfu/verizon-sfdev
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Xperia(TM) PLAY
It's a major breakthrough. An authentic gaming
smartphone on the nation's most reliable network.
And it wants your games.
http://p.sf.net/sfu/verizon-sfdev
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to