Hi list,
To get the size in pixels of an object whose size was set in %, i found the _computeBoxHeight() private method. (ok, it's a private method of QxWidget, perhaps i souldn't use it?...)
var c = new QxBoxLayout();
c.setHeight("50%");
d.add(c);
this.warn("c.getHeight: "+c.getHeight());// --- string "50%", no pixel number ---
this.warn("c._computeBoxHeight: "+c._computeBoxHeight());// --- ok, pixel number ---
But if the object from which i need the size in pixel is inside another one (not registered directly in the document), then _computeBoxHeight cannot get the size in percent: it still doesn't know its parent:
var c = new QxBoxLayout();
c.setHeight(300);
var c2 = new QxBoxLayout();
c2.setHeight("30%");
c.add(c2);
this.warn("c2.getHeight: "+c2.getHeight());//string "30%", no pixel number
this.warn("c2._computeBoxHeight: "+c2._computeBoxHeight());// --- TypeError: this.getParent() has no properties ---
d.add(c);
c2._computeBoxHeight() would work if c2's parent (c) was already added to the document.
--> My question is: is there a way to get the size, in pixel, of c2, i.e. of an object whose size was set in % and which is not yet added to the document? Is there a better way than the private method _computeBoxHeight()?
Thanks for your help.
Elie
To get the size in pixels of an object whose size was set in %, i found the _computeBoxHeight() private method. (ok, it's a private method of QxWidget, perhaps i souldn't use it?...)
var c = new QxBoxLayout();
c.setHeight("50%");
d.add(c);
this.warn("c.getHeight: "+c.getHeight());// --- string "50%", no pixel number ---
this.warn("c._computeBoxHeight: "+c._computeBoxHeight());// --- ok, pixel number ---
But if the object from which i need the size in pixel is inside another one (not registered directly in the document), then _computeBoxHeight cannot get the size in percent: it still doesn't know its parent:
var c = new QxBoxLayout();
c.setHeight(300);
var c2 = new QxBoxLayout();
c2.setHeight("30%");
c.add(c2);
this.warn("c2.getHeight: "+c2.getHeight());//string "30%", no pixel number
this.warn("c2._computeBoxHeight: "+c2._computeBoxHeight());// --- TypeError: this.getParent() has no properties ---
d.add(c);
c2._computeBoxHeight() would work if c2's parent (c) was already added to the document.
--> My question is: is there a way to get the size, in pixel, of c2, i.e. of an object whose size was set in % and which is not yet added to the document? Is there a better way than the private method _computeBoxHeight()?
Thanks for your help.
Elie
------------------------------------------------------------------------- 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
