PDA

View Full Version : [CLOSED] Possible bug in ColumnLayout



staffan
4 Jul 2008, 5:51 AM
Hi!

I'm using the ColumnLayout on a FormPanel and i discovered some unexpected behaviour when using three decimals to specify column width. See exempel below, here suiDetails is the Formpanel (with ColumnLayout) and first-second are LayoutContainers. This code:


suiDetails.add(first,

new ColumnData(0.2));
suiDetails.add(second, new ColumnData(0.2));
suiDetails.add(third, new ColumnData(0.225));
suiDetails.add(fourth, new ColumnData(0.225));

suiDetails.add(fifth, new ColumnData(0.15));

..will result in a FormPanel where 'fifth' turns up at the left side below 'first' and not as a fifth column as expected. There is enough room for the LayoutContainers in the FormPanel. (If the FormPanel is collapsed and the reopened, the 'fifth' turns up where it supposed to be, on the right side!!!)

Changing the code to:

suiDetails.add(first,

new ColumnData(0.2));
suiDetails.add(second, new ColumnData(0.2));
suiDetails.add(third, new ColumnData(0.2));
suiDetails.add(fourth, new ColumnData(0.2));

suiDetails.add(fifth, new ColumnData(0.15));

..will generate the expected result; five columns beside each other.

Is the ColumnLayout unable to handle three decimals? Maybe the 0.225-values are rounded to 0.23 somewhere?

Suggestion:
Make a note in the API not to use more than 2 decimals when specifying width as percent.

darrellmeyer
7 Jul 2008, 10:38 AM
Percentage values are translated to pixels (int), so your values are most likely resulting in extra pixels. Keep in mind that HTML and CSS units can only be expressed as whole numbers, so a value of .225 could not be specified in HTML or CSS.