Describe the bug
We want to make a column as wide as the visible area (client area) without showing a horizontal scrollbar (just like a list). For that we set the client area's width in the MeasureItem event. However, this causes the table to show a horizontal scrollbar, and the item's width only can grow when resizing the table, but not shrink.
To Reproduce
Using Snippet 271 for inspiration:
import org.eclipse.swt.*;
import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.widgets.*;
final class TableWithoutColumnTest {
public static void main(String[] args) {
final Display display = new Display ();
final Shell shell = new Shell (display);
shell.setLayout(new FillLayout());
final Table table = new Table (shell, SWT.VIRTUAL | SWT.BORDER | SWT.V_SCROLL | SWT.FULL_SELECTION);
table.addListener (SWT.SetData, event -> {
final TableItem item = (TableItem) event.item;
final int index = table.indexOf (item);
item.setText ("Item " + index);
});
table.addListener(SWT.MeasureItem, event -> {
event.width = table.getClientArea().width;
});
table.setItemCount(100);
table.setSelection(0);
shell.setSize (200, 200);
shell.open ();
while (!shell.isDisposed()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}
Expected behavior
The table should never show a horizontal scrollbar and all rows should be as wide as the client area.
Screenshots

Note the horizontal scrollbar. The table remembers the maximum width + x. (Also note the tiny drawing glitch (gray area in the selected row) when starting the resize.)
Environment:
- Select the platform(s) on which the behavior is seen:
- Additional OS info (e.g. OS version, Linux Desktop, etc)
Windows 11 25H2, 175% zoom
Describe the bug
We want to make a column as wide as the visible area (client area) without showing a horizontal scrollbar (just like a list). For that we set the client area's width in the MeasureItem event. However, this causes the table to show a horizontal scrollbar, and the item's width only can grow when resizing the table, but not shrink.
To Reproduce
Using Snippet 271 for inspiration:
Expected behavior
The table should never show a horizontal scrollbar and all rows should be as wide as the client area.
Screenshots

Note the horizontal scrollbar. The table remembers the maximum width + x. (Also note the tiny drawing glitch (gray area in the selected row) when starting the resize.)
Environment:
Windows 11 25H2, 175% zoom