Hi,

If you look at the sample code, it is very hard to figure out the 
hierarchical relationship, between items.  As a example of this, we have 
http://old.qooxdoo.org/public/demo/example/Tree_1.html.

Simply, I wanted to share the code style I'm trying to use to emphasize 
the parent-child relationship, because I use very nested structures, 
that are otherwise hard to understand at a glance.

Sebastian Werner schrieb:
> David Perez schrieb:
>   
>> Hi,
>>
>> I'm new to the exciting Qooxdoo world.
>>
>> I find a little confusing the layout code in Javascript, I cannot see 
>> easily the parent/children relationship.
>>     
>
> I don't really understand your problem. But instead of this
>
> parent.add(children)
>
> you could also do
>
> children.setParent(parent);
>
> Maybe this help.
>
> Sebastian
>
>   
>> So I have tried successfully this style as a 1st approach:
>>
>> window.application.main = function() {
>>     function pon(e, func) {
>>         e.add(func());
>>     }
>>     pon(this, function() {
>>         var e = new QxBoxLayout;
>>         with (e) {
>>             setWidth('100%');
>>             setLeft(5);
>>             setRight(5);
>>             setTop(70);
>>             setBottom(20);
>>             setSpacing(5);
>>         }
>>         pon(e, function() {
>>             var e = new QxVerticalBoxLayout;
>>             with (e) {
>>                 setWidth('50%');
>>                 setSpacing(5);
>>             }
>>             pon(e, function() {
>>                 var e = new QxBoxLayout;
>>                 with (e) {
>>                     setHeight('auto');
>>                 }
>>                 pon(e, function() {
>>                     var e = new QxButton('Editar');
>>                     with (e) {
>>                         addEventListener("execute", function() 
>> {alert(this.getLabel())});
>>                     }
>>                     return e;
>>                 });
>>                 return e;
>>             });
>>             pon(e, function() {
>>                 var e = new QxTree('Libros');
>>                 iniArbol(e);
>>                 with (e) {
>>                     setHeight('5*');
>>                     getManager().addEventListener("changeSelection", 
>> function(v) {
>>                        
>>  alert(v.getData().getFirst()._labelObject.getHtml());
>>                     });
>>                 }
>>                 cargaLibros(e);
>>                 return e;
>>             });
>>             return e;
>>         });
>>         pon(e, function() {
>>             var e = new QxVerticalBoxLayout;
>>             with (e) {
>>                 setWidth('50%');
>>             }
>>             pon(e, function() {
>>                 var e = new QxAtom('Fascículos del libro seleccionado');
>>                 with (e) {
>>                 }
>>                 return e;
>>             });
>>             pon(e, function() {
>>                 var e = new QxTree('Fascículos');
>>                 iniArbol(e);
>>                 with (e) {
>>                     setHeight('5*');
>>                 }
>>                 return e;
>>             });
>>             return e;
>>         });
>>     });
>> };
>>
>> I have created an auxiliary function called 'pon', that adds a child to 
>> the current parent.  I name all the elements as 'e' for simplicity.
>> As it can be seen at a glance, I create a QBoxLayout that has 2 
>> QVerticalLayout children.
>> The 1st QVerticalLayout has inside a QBoxLayout with buttons and a tree.
>> The 2nd QVerticalLayout has inside a QBoxLayout with text and another tree.
>>
>> Has anyone found a better style?
>> Any ideas will be very welcome.
>>     


                
______________________________________________ 
LLama Gratis a cualquier PC del Mundo. 
Llamadas a fijos y móviles desde 1 céntimo por minuto. 
http://es.voice.yahoo.com


-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to