Hello Stefan,

after some time, I did see what your problem is and I can explain whats 
happening here. To see whats happening, its always a good idea to see the shape 
of all widgets. The label widgets does not necessarily have the same size as 
the label itself. Thats why I like to use a background color to see the size of 
the widget. Thats what I did in your case after some refactoring:

http://tinyurl.com/2ah23um

Take a look at the first example. You are using padding on the widgets which 
defines the inner distance. Thats why the textfield is getting bigger because 
you increase the inner distance. As you see, also the label is getting bigger.

The second case uses margins which define the outer distance to close objects. 
Here you see, that the label is not getting bigger. Both widgets have the same 
distance to the top edge.

Now to your last example. Using the colored label shows you, that its only 
coincidence that this is working as you desired and it can not be the solution 
we are looking for.

The main reason for that behavior is the difference of the widgets height. As 
you see in spot 4 in the example, I added a layout independent way to get that 
working as expected. You set the margin to both, calculate the difference in 
height and add half the difference as padding to the label.

Best,
Martin

P.S. Please try to explain your problem in less code as possible. It always 
takes us a lot of time to get the the bottom of the problem.


Am 31.08.2010 um 22:16 schrieb Stefan Andersson:

I have some strange behaviour here:

1. odd padding -> textfield glues with the above cell but not label

var mobilePhoneTF = this.__mobilePhoneTF = new 
qx.ui.form.TextField(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneTF.setRequired(true);
mobilePhoneTF.setWidth(100);
mobilePhoneTF.setAllowGrowX(false);

var mobilePhoneL = this.__mobilePhoneL = new 
qx.ui.basic.Label(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneL.setBuddy(mobilePhoneTF);
mobilePhoneL.setAlignY("middle");


// Document is the application root
var doc = this.getRoot();

var layoutG = new qx.ui.layout.Grid(1, 2);

doc.setLayout(layoutG);

this.__mobilePhoneL.setPaddingTop(10);
this.__mobilePhoneTF.setPaddingTop(10);

doc.add(this.__mobilePhoneL, {row: 0, column: 0});
doc.add(this.__mobilePhoneTF, {row: 0, column: 1});

2. odd margin -> setAlignY("middle") does not work -> label middled including 
the padding

var mobilePhoneTF = this.__mobilePhoneTF = new 
qx.ui.form.TextField(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneTF.setRequired(true);
mobilePhoneTF.setWidth(100);
mobilePhoneTF.setAllowGrowX(false);

var mobilePhoneL = this.__mobilePhoneL = new 
qx.ui.basic.Label(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneL.setBuddy(mobilePhoneTF);
mobilePhoneL.setAlignY("middle");


// Document is the application root
var doc = this.getRoot();

var layoutG = new qx.ui.layout.Grid(1, 2);

doc.setLayout(layoutG);

this.__mobilePhoneL.setMarginTop(10);
this.__mobilePhoneTF.setMarginTop(10);

doc.add(this.__mobilePhoneL, {row: 0, column: 0});
doc.add(this.__mobilePhoneTF, {row: 0, column: 1});

3. correct behaviour = a mix solves the problem

var mobilePhoneTF = this.__mobilePhoneTF = new 
qx.ui.form.TextField(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneTF.setRequired(true);
mobilePhoneTF.setWidth(100);
mobilePhoneTF.setAllowGrowX(false);

var mobilePhoneL = this.__mobilePhoneL = new 
qx.ui.basic.Label(this<http://this.tr>.<http://this.tr>tr<http://this.tr>("Mobile
 phone number"));
mobilePhoneL.setBuddy(mobilePhoneTF);
mobilePhoneL.setAlignY("middle");


// Document is the application root
var doc = this.getRoot();

var layoutG = new qx.ui.layout.Grid(1, 2);

doc.setLayout(layoutG);

this.__mobilePhoneL.setPaddingTop(10);
this.__mobilePhoneTF.setMarginTop(10);

doc.add(this.__mobilePhoneL, {row: 0, column: 0});
doc.add(this.__mobilePhoneTF, {row: 0, column: 1});

-------------

Anyone who can tell if it is a normal behaviour or a bug? To me it seems to be 
strange calculations.

Stefan
<ATT00001..txt><ATT00002..txt>

------------------------------------------------------------------------------
This SF.net Dev2Dev email is sponsored by:

Show off your parallel programming skills.
Enter the Intel(R) Threading Challenge 2010.
http://p.sf.net/sfu/intel-thread-sfd
_______________________________________________
qooxdoo-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

Reply via email to