Bug 130031 - cannot specify TableItem height to smaller value than default
Summary: cannot specify TableItem height to smaller value than default
Status: RESOLVED DUPLICATE of bug 154341
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows 2000
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Steve Northover CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-01 16:13 EST by Grant Gayed CLA
Modified: 2006-11-20 10:53 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Grant Gayed CLA 2006-03-01 16:13:29 EST
- run the snippet below to see that changing item height (larger) in the initial MeasureItem callback is working
- now uncomment the "event.height = 6;" line and note that the item heights are now their normal 14 pixels (at least according to the EraseItem callback), not 6 as was requested
- on osx they become the requested smaller-than-default size

public static void main(String[] args) {
	final Display display = new Display();
	Shell shell = new Shell(display);
	shell.setBounds(10,10,200,200);
	final Table table = new Table(shell, SWT.NONE);
	table.setBounds(10,10,150,100);
	new TableItem(table, SWT.NONE).setText("item 1");
	new TableItem(table, SWT.NONE).setText("item 2");
	table.addListener(SWT.MeasureItem, new Listener() {
		public void handleEvent(Event event) {
			event.height = 30;
			//event.height = 6;
		}
	});
	table.addListener(SWT.EraseItem, new Listener() {
		public void handleEvent(Event event) {
			System.out.println("Erase " + event.getBounds());
		}
	});
	shell.open();
	while (!shell.isDisposed()) {
		if (!display.readAndDispatch()) display.sleep();
	}
	display.dispose();
}
Comment 1 fdesforges CLA 2006-07-07 04:29:59 EDT
(In reply to comment #0)
> - run the snippet below to see that changing item height (larger) in the
> initial MeasureItem callback is working
> - now uncomment the "event.height = 6;" line and note that the item heights are
> now their normal 14 pixels (at least according to the EraseItem callback), not
> 6 as was requested
> - on osx they become the requested smaller-than-default size
> 
> public static void main(String[] args) {
>         final Display display = new Display();
>         Shell shell = new Shell(display);
>         shell.setBounds(10,10,200,200);
>         final Table table = new Table(shell, SWT.NONE);
>         table.setBounds(10,10,150,100);
>         new TableItem(table, SWT.NONE).setText("item 1");
>         new TableItem(table, SWT.NONE).setText("item 2");
>         table.addListener(SWT.MeasureItem, new Listener() {
>                 public void handleEvent(Event event) {
>                         event.height = 30;
>                         //event.height = 6;
>                 }
>         });
>         table.addListener(SWT.EraseItem, new Listener() {
>                 public void handleEvent(Event event) {
>                         System.out.println("Erase " + event.getBounds());
>                 }
>         });
>         shell.open();
>         while (!shell.isDisposed()) {
>                 if (!display.readAndDispatch()) display.sleep();
>         }
>         display.dispose();
> }
> 

Hi,
i've the same problem as you and see that a first limition in the table class :
the method that is requested by this event do :
if (event.height > getItemHeight ()) setItemHeight (event.height);
So normal that item don't grow :(.
On windows i try it with  only setItemHeight (event.height); and it work.
Think that this limition come from other os.

regards

Comment 2 Grant Gayed CLA 2006-11-20 10:53:53 EST

*** This bug has been marked as a duplicate of 154341 ***