Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [platform-swt-dev] TreeColumn Labels have to be the same size?


I must be missing something. The snippet below produces the following snap on Windows XP.
Is this not what you meant?
Carolyn




package test;

import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;

public class TreeTableImageTest {
        static Display display;
        static Shell shell;
        static Tree tree;
        static Image image;
               
        public static void main(String[] args) {
                display = new Display();
                image = new Image(display, TreeTableImageTest.class.getResourceAsStream("wide.gif"));
                shell = new Shell(display);
                shell.setLayout(new GridLayout());
                tree = new Tree(shell, SWT.BORDER | SWT.MULTI);
                tree.setHeaderVisible(true);
                tree.setLinesVisible(true);
                tree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
                for (int col = 0; col < 2; col++) {
                        TreeColumn column = new TreeColumn(tree, SWT.NONE);
                        column.setText("Column" + col);
                }
                for (int i = 0; i < 3; i++) {
                        TreeItem item = new TreeItem(tree, SWT.NONE);
                        item.setText("Item" + i);
                        for (int j = 0; j < 4; j++) {
                                new TreeItem(item, SWT.NONE).setText("Item" + i + j);
                        }
                        item.setImage(1, image);
                }
                tree.getColumn(0).setWidth(60);
                tree.getColumn(1).pack();

                shell.pack();
                shell.open();
                while (!shell.isDisposed()) {
                        if (!display.readAndDispatch()) display.sleep();
                }
                image.dispose();
                display.dispose();
        }
}



Steve Northover/Ottawa/IBM@IBMCA
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

11/03/2005 05:18 PM

Please respond to
"Eclipse Platform SWT component developers list."

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
Re: [platform-swt-dev] TreeColumn Labels have to be the same size?






This is a Microsoft Windows limitation.



Eric Zimmerman <eric@xxxxxxxxxxx>
Sent by: platform-swt-dev-bounces@xxxxxxxxxxx

11/03/2005 04:35 PM

Please respond to
"Eclipse Platform SWT component developers list."

To
"Eclipse Platform SWT component developers list." <platform-swt-dev@xxxxxxxxxxx>
cc
Subject
Re: [platform-swt-dev] TreeColumn Labels have to be the same size?







Casey A Dugan wrote:

>I have changed my old TableViewer to a TreeViewer with TreeColumns. It has a
>ITreeContentProvider and an ITableLabelProvider. There are 2 columns, the first
>one should only have text, the second one only a very wide image.
>
>Here's the mystery:
>
>If I return a 1258 pixel image for the 2nd column image and a null image for the
>first column, the 1st column will resize to be 1258 (there are very short text
>labels...).
>
>If I return a 5 pixel wide image for the first column and a 1258 pixel wide
>image for the second column I get: a 5 pixel image for the first column and a 5
>pixel squashed version of my 1258 pixel image.
>
>Do label images for different columns in a Tree have to be the same size? Is
>there another way to display my tree with very large images to the right of
>each TreeItem (without squashing either...)? I've found other problems similar
>elsewhere on the internet but no one seemed to have an answer.Thanks!
>
I believe this is an underlying table limitation.  I have run into
problems with images in tables before.  It seems that the first image
you set is the the width your stuck with, as far as I can remember :-)  
Maybe it's been fixed/changed in more recent swt updates??

Eric
_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev

_______________________________________________
platform-swt-dev mailing list
platform-swt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/platform-swt-dev


Back to the top