Hi Peter,
>
>
> I'm new with qooxdoo and want to define some classes with properties.
> This is the first example i tried to wrote. It works but i have a 
> feeling that this solution is against some conventions.
> In the qooxdoo manual there isnt any example about how to initialize 
> properties with Object types.
>
> So i want to know how you solve the init value problem and may suggest 
> some better solution for a  basic(no checks, just the basic get/set 
> functionality) _apply function.
This is how I would do it as well. Keep in mind that using reference 
types like arrays, maps and objects in the "init" key of a property 
definition will be shared by all instances because only the reference is 
copied. You do exactly the right thing by initializing the property in 
the constructor.

Best Fabian


>
>     qx.Class.define("custom.Box",
>     {
>         extend : qx.ui.layout.BoxLayout,
>        
>        
>         construct : function(){
>             this.base(arguments);
>            
>             this.setTextBox(new qx.ui.form.TextField());
>            
>             this.add(this.textBox);
>         },
>        
>         properties : {      
>             textBox : {
>                 init : null,
>                 apply: "_applyText",
>                 check: "qx.ui.form.TextField"
>             }
>         },
>
>         members : {
>             _applyText : function(value, oldValue){
>                 this.textBox = value;
>                 return value;
>             },
>          }
>     }
>
>
> Thanks for the help,
>
>  Peter
>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services for
> just about anything Open Source.
> http://sourceforge.net/services/buy/index.php
> ------------------------------------------------------------------------
>
> _______________________________________________
> qooxdoo-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
>   


-- 
Fabian Jakobs
JavaScript Framework Developer

1&1 Internet AG
Brauerstraße 48
76135 Karlsruhe

Amtsgericht Montabaur HRB 6484

Vorstand: Henning Ahlert, Ralph Dommermuth, Matthias Ehrlich, Thomas 
Gottschlich, Matthias Greve, Robert Hoffmann, Markus Huhn, Oliver Mauss, Achim 
Weiss
Aufsichtsratsvorsitzender: Michael Scheeren


-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to