[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[news.eclipse.platform.swt] SWT.EraseItem draw event

Hi all,

I use Eclipse 3.2.1
I am creating a view (for a plugin) wich contains a table. As I want to customize the table I use the SWT.EraseItem draw event where I change the cell size. If the change of the heigth works the change of the width does not. Is it a bug or have I done something wrong ?


public void createPartControl(Composite parent) {
   Display display = parent.getDisplay();

   final Table table = new Table(parent, SWT.NONE);
   table.setBounds(10, 10, 150, 200);
   table.setLinesVisible(true);

   final TableColumn column0 = new TableColumn(table, SWT.NONE);
		column0.setWidth(100);
   final TableColumn column1 = new TableColumn(table, SWT.NONE);
		column1.setWidth(100);
   for (int i = 0; i < 5; i++) {
      TableItem item = new TableItem(table, SWT.NONE);
      item.setText(0, "item " + i + " col 0");
      item.setText(1, "item " + i + " col 1");
   }
	
   final Color red = display.getSystemColor(SWT.COLOR_RED);
   final Color yellow = display.getSystemColor(SWT.COLOR_YELLOW);
		
   table.addListener(SWT.MeasureItem, new Listener() {
      public void handleEvent(Event event) {
		
         int clientWidth = table.getClientArea().width;
	 event.height = 100; // works
	 event.width = 300; // does not work !!!????
							
      }
   });
}