Here is a little more information that might give a better idea of what I'm
attempting to accomplish. I'm still learning Qooxdoo so I'm sure my class
could be better constructed :-) As you can see in the commented-out parts,
I've tried it with several combinations of font, no-font, etc., with little
practical difference-- none of it yielded a font-height value. I want to set
the width of the overall box based on a number of characters permitted in
any particular label (which I haven't coded yet), and the box's height based
on the height of the font used plus any padding from the VBox layout (at the
moment set to one).

Thanks,

John


--


qx.Class.define("myapp.ui.LabelBox",
{
        extend : qx.ui.core.Widget,

        include : [
                qx.ui.form.MModelProperty,
                qx.ui.core.MLayoutHandling,
                qx.ui.core.MChildrenHandling
                ],

        construct : function(itemOne, itemTwo, itemThree, itemFour)
        {
                var box_spacing = 1;
                var num_labels = 4;

                this.base(arguments);
                this.setLayout(new qx.ui.layout.VBox(box_spacing));

                this.labelItemOne = new qx.ui.basic.Label().set({
//                      decorator: "main", padding: 0, rich: true,
//                      font: "Bold",
                        textAlign: "center", allowGrowX: true, allowGrowY:
true
                        });
                this.add(this.labelItemOne, {flex: 1});
                if (itemOne) {
                        this.setItemOne(itemOne);
                        }

                this.labelItemTwo = new qx.ui.basic.Label().set({
//                      decorator: "main", padding: 0, rich: true,
//                      font: "Bold",
                        textAlign: "center", allowGrowX: true, allowGrowY:
true
                        });
                this.add(this.labelItemTwo, {flex: 1});
                if (itemTwo) {
                        this.setItemTwo(itemTwo);
                        }

                this.labelItemThree = new qx.ui.basic.Label().set({
//                      decorator: "main", padding: 0, rich: true,
//                      font: "Bold",
                        textAlign: "center", allowGrowX: true, allowGrowY:
true
                        });
                this.add(this.labelItemThree, {flex: 1});
                if (itemThree) {
                        this.setItemThree(itemThree);
                        }

                this.labelItemFour = new qx.ui.basic.Label().set({
//                      decorator: "main", padding: 0, rich: true,
//                      font: "Bold",
                        textAlign: "center", allowGrowX: true, allowGrowY:
true
                        });
                this.add(this.labelItemFour, {flex: 1});
                if (itemFour) {
                        this.setItemFour(itemFour);
                        }


                // compute preferred box size

                var myFont = this.labelItemOne.getFont();
                var myFontHeight = myFont.getHeight();

                var myHeight = (( box_spacing * 2) + myFontHeight) *
num_labels;


                this.set({
                        minWidth : 64, maxWidth : 128,
                        minHeight : myHeight, maxHeight : myHeight
                        });
        },

        properties : {
                itemOne : {
                        init : "ItemOne",
                        apply: "_applyItemOne"
                        },
                itemTwo : {
                        init : "ItemTwo",
                        apply: "_applyItemTwo"
                        },
                itemThree : {
                        init : "ItemThree",
                        apply: "_applyItemThree"
                        },
                itemFour : {
                        init : "ItemFour",
                        apply: "_applyItemFour"
                        }
                },

        members : {

                _applyItemOne : function(value, old) {
                        this.labelItemOne.setValue(String(value));
                        },
                _applyItemTwo : function(value, old) {
                        this.labelItemTwo.setValue(String(value));
                        },
                _applyItemThree : function(value, old) {
                        this.labelItemThree.setValue(String(value));
                        },
                _applyItemFour : function(value, old) {
                        this.labelItemFour.setValue(String(value));
                        },

                _getFontSize : function() {
                        return this.labelItemOne.getFont().getHeight();
                        }

                }
        }
);




--
View this message in context: 
http://qooxdoo.678.n2.nabble.com/default-font-not-applied-tp4150015p7580861.html
Sent from the qooxdoo mailing list archive at Nabble.com.

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to