Community
Participate
Working Groups
When using a Virtual Table to display data, scrolling becomes very slow and sluggish when setting lines visible. However, this only happens when using a relatively low number of items (in my case between 2000 and 20000 items). The code snippet is a modified version of the one provided on the snippets page: static final int COUNT = 2000; public static void main(String[] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.setLayout (new GridLayout()); final Table table = new Table (shell, SWT.VIRTUAL | SWT.BORDER); table.addListener (SWT.SetData, new Listener () { public void handleEvent (Event event) { TableItem item = (TableItem) event.item; int index = table.indexOf (item); item.setText (0, "Item " + index); for (int i = 1; i <= 10; i++) { item.setText(i, index + " test " + i); } } }); GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); gridData.heightHint = 200; table.setLayoutData(gridData); table.setHeaderVisible(true); table.setLinesVisible(true); Button button = new Button (shell, SWT.PUSH); button.setText ("Add Items"); for (int i = 1; i <= 10; i++) { TableColumn column = new TableColumn(table, SWT.NONE); column.setText("header " + i); } final Label label = new Label(shell, SWT.NONE); button.addListener (SWT.Selection, new Listener () { public void handleEvent (Event event) { long t1 = System.currentTimeMillis (); table.setItemCount (COUNT); long t2 = System.currentTimeMillis (); label.setText ("Items: " + COUNT + ", Time: " + (t2 - t1) + " (ms)"); shell.layout (); } }); for (TableColumn column: table.getColumns()) { column.pack(); } shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); } Surprisingly, when changing the count to 1000000 the scrolling is a lot more smooth. Setting lines visible to true is essential to create the sluggishness. (I tested 3.7M1 as well and the problem still exists.)
I had also this problem in Virtual Tree. Problem was with scrolling and columns resizing. On Windows works quite well. This issue occur for me only with viewer with columns.
Running the snippet attached yields a Table with nothing visible. Clicking anywhere inside the table prints the following error: (SWT:7105): Gtk-CRITICAL **: file a11y/gtktreeviewaccessible.c: line 295 (get_visible_column): should not be reached
(In reply to Eric Williams from comment #2) > Running the snippet attached yields a Table with nothing visible. Clicking > anywhere inside the table prints the following error: > > (SWT:7105): Gtk-CRITICAL **: file a11y/gtktreeviewaccessible.c: line 295 > (get_visible_column): should not be reached I cannot reproduce this any longer: the snippet works as intended. Scrolling is completely smooth.