After investigating it seems you've found a bug.  Row headers and 
SWT.VIRTUAL have issues.  I've entered a new bugzilla issue for it:
https://bugs.eclipse.org/bugs/show_bug.cgi?id=199297

I've implemented a fix (that may be only temporary but should be good for 
your scenario).  There is more info in the bug.  The fix will be included 
in tonight's nightly build.  If you download that tomorrow you should be 
ok.  Let me know.

Regards,
-Chris



From:
"Jonathan Alvarsson" <[EMAIL PROTECTED]>
To:
"Nebula Dev" <[email protected]>
Date:
08/08/2007 12:09 PM
Subject:
Re: [nebula-dev] Lazy initialisation of grid


On 8/8/07, Christopher J Gross <[EMAIL PROTECTED]> wrote:

You need to call setItemCount.  Tell the Grid how many items you want. 

Regards, 
-Chris 

Okey so this is how it looks now. 

It still don't call handleEvent() and hence all the cells are empty... :(



import org.eclipse.nebula.widgets.grid.Grid;
import org.eclipse.nebula.widgets.grid.GridColumn ;
import org.eclipse.nebula.widgets.grid.GridItem;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout ;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Listener;
import org.eclipse.swt.widgets.Shell;

public class VirtualGridWidget {
    public static void main(String... args) { 
        Display display = new Display();
        Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
 
        Grid grid = new Grid( shell, SWT.BORDER | SWT.V_SCROLL | 
SWT.H_SCROLL | SWT.VIRTUAL | SWT.MULTI );
        grid.setHeaderVisible(true);
        grid.setRowHeaderVisible(true);
        grid.setCellSelectionEnabled(true);
 
        grid.setItemHeight(20); 
        grid.setItemCount(10);
        for (int i = 0; i < 10; i++) {
 
            GridColumn column = new GridColumn(grid, SWT.NONE);
            column.setText(i + "");
            column.setWidth(40);
        } 
 
        grid.addListener( SWT.SetData, new Listener() {
            public void handleEvent(Event event) {
                System.out.println("handleEvent()");
                GridItem item = (GridItem)event.item; 
                for (int i = 0; i < 10; i++) {
                    item.setText(i, i + "");
                    item.setHeaderText( ('a'+i) + "" );
                }
            } 
        } );
 
        shell.setSize(500, 200);
        shell.open();
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch())
                display.sleep();
        } 
        display.dispose();
    }
}_______________________________________________
nebula-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/nebula-dev

_______________________________________________
nebula-dev mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/nebula-dev

Reply via email to