TableItem Row resizing [message #441186] |
Wed, 11 August 2004 14:58 |
Eclipse User |
|
|
|
Originally posted by: rohitdev.kulshrestha.patni.com
1. I need to Resize the cell height of
org.eclipse.swt.custom.TableTree.How do i do it?
2. I also need to display Image object in cell of it & be able to resize
the image for it.Can somebody help me out?
|
|
|
Re: TableItem Row resizing [message #441526 is a reply to message #441186] |
Mon, 16 August 2004 20:23 |
Veronika Irvine Messages: 1272 Registered: July 2009 |
Senior Member |
|
|
Row height is based on the maximum value of either Font height or Image
height (see TableTree.setFont() and TableTreeItem.setImage()). There is no
independant way to set this. On almost all platforms, all rows must have
the same height.
Once an image is set into a Table (or TableTree) all subsequent images are
made the same size and there is no way to change the size of the images.
The size of the first image set in a table determines the height of all
images.
There is a problem in TableTree because as soon as the first TableTreeItem
is added to the TableTree, an image is created for the +/- and this
determines the height of all images that come after. Here is a hack to work
around this:
public static void main (String [] args) {
Display display = new Display ();
Image large = new Image(display,
Main.class.getResourceAsStream("images/image100x100.bmp"));
Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
TableTree table = new TableTree(shell, SWT.BORDER);
TableColumn column1 = new TableColumn(table.getTable(), SWT.NONE);
TableColumn column2 = new TableColumn(table.getTable(), SWT.NONE);
//Begin Hack
TableItem bogus = new TableItem(table.getTable(), SWT.NONE);
bogus.setImage(large);
bogus.dispose();
// End Hack
for (int i = 0; i < 10; i++) {
TableTreeItem item = new TableTreeItem(table, SWT.NONE);
item.setText("item "+i);
item.setImage(1, large);
for (int j = 0; j < 3; j++) {
TableTreeItem item2 = new TableTreeItem(item, SWT.NONE);
item2.setText("item "+i+" "+j);
item2.setImage(1, large);
}
}
column1.setWidth(300);
column2.setWidth(200);
shell.pack();
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
"Rohitdev Kulshrestha" <rohitdev.kulshrestha@patni.com> wrote in message
news:cfdc5q$4m7$1@eclipse.org...
> 1. I need to Resize the cell height of
> org.eclipse.swt.custom.TableTree.How do i do it?
>
> 2. I also need to display Image object in cell of it & be able to resize
> the image for it.Can somebody help me out?
>
>
>
|
|
|
Re: TableItem Row resizing [message #441700 is a reply to message #441526] |
Fri, 20 August 2004 13:50 |
Eclipse User |
|
|
|
Originally posted by: rohitdev.kulshrestha.patni.com
Veronika Irvine wrote:
> Row height is based on the maximum value of either Font height or Image
> height (see TableTree.setFont() and TableTreeItem.setImage()). There is no
> independant way to set this. On almost all platforms, all rows must have
> the same height.
> Once an image is set into a Table (or TableTree) all subsequent images are
> made the same size and there is no way to change the size of the images.
> The size of the first image set in a table determines the height of all
> images.
> There is a problem in TableTree because as soon as the first TableTreeItem
> is added to the TableTree, an image is created for the +/- and this
> determines the height of all images that come after. Here is a hack to work
> around this:
> public static void main (String [] args) {
> Display display = new Display ();
> Image large = new Image(display,
> Main.class.getResourceAsStream("images/image100x100.bmp"));
> Shell shell = new Shell (display);
> shell.setLayout(new FillLayout());
> TableTree table = new TableTree(shell, SWT.BORDER);
> TableColumn column1 = new TableColumn(table.getTable(), SWT.NONE);
> TableColumn column2 = new TableColumn(table.getTable(), SWT.NONE);
> //Begin Hack
> TableItem bogus = new TableItem(table.getTable(), SWT.NONE);
> bogus.setImage(large);
> bogus.dispose();
> // End Hack
> for (int i = 0; i < 10; i++) {
> TableTreeItem item = new TableTreeItem(table, SWT.NONE);
> item.setText("item "+i);
> item.setImage(1, large);
> for (int j = 0; j < 3; j++) {
> TableTreeItem item2 = new TableTreeItem(item, SWT.NONE);
> item2.setText("item "+i+" "+j);
> item2.setImage(1, large);
> }
> }
> column1.setWidth(300);
> column2.setWidth(200);
> shell.pack();
> shell.open ();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> "Rohitdev Kulshrestha" <rohitdev.kulshrestha@patni.com> wrote in message
> news:cfdc5q$4m7$1@eclipse.org...
> > 1. I need to Resize the cell height of
> > org.eclipse.swt.custom.TableTree.How do i do it?
> >
> > 2. I also need to display Image object in cell of it & be able to resize
> > the image for it.Can somebody help me out?
> >
> >
> >
I have tried out the code/hack youi suggested.But it did not seem to help.
Although the image was bigger then what i was getting previously.
So how do i progress ahead.
Do i need to write a new swidget ?
Also should future implementations of Tabletree should not have such
restrictions as it binds itself to firm restrictions & does not server the
purpose.
I request the SWT community members to please take it as a contructive
view for future implementaions.
|
|
|
Powered by
FUDForum. Page generated in 0.02942 seconds