Community
Participate
Working Groups
The TreeItem#preferredWidthBuffer field is not column aware. Test case to reproduce it: public void testGetPreferredCellWidthForColumn() { Tree tree = new Tree( composite, SWT.NONE ); createColumns( tree, 3 ); TreeItem item = new TreeItem( tree, SWT.NONE ); item.setText( 0, "short" ); item.setText( 1, "very long text" ); int width1 = tree.getPreferredCellWidth( item, 0, false ); int width2 = tree.getPreferredCellWidth( item, 1, false ); assertTrue( width2 > width1 ); }
Fixed by moving the prefferedWidthBuffer into the TreeItem#Data class.