[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[nebula-dev] event.index always 0 in handleEvent for SWT.VIRTUAL mode. BUG?
|
The event.index seems to always be 0. Is this the intended behavior and if so how should I do instead?
Se snippet.
--
// Jonathan
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.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) {
GridItem item = (GridItem)event.item;
item.setHeaderText( (char)('A' + event.index) + "" ); // <========== HERE
for (int i = 0; i < 10; i++) {
item.setText
(i, i + "");
}
}
} );
grid.setHeaderVisible(true);
grid.setRowHeaderVisible(true);
shell.setSize(500, 200);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}