Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 312960

Summary: org.eclipse.swt.custom.PopupList - should be able to set the SWT.H_SCROLL style on the List widget
Product: [Eclipse Project] Platform Reporter: Nick Chiu <Nick.Chiu>
Component: SWTAssignee: Lakshmi P Shanmugam <lshanmug>
Status: RESOLVED FIXED QA Contact: Lakshmi P Shanmugam <lshanmug>
Severity: enhancement    
Priority: P3 CC: eclipse.felipe, remy.suen, Silenio_Quarti
Version: 3.4   
Target Milestone: 3.7 M2   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Attachments:
Description Flags
patch-1 none

Description Nick Chiu CLA 2010-05-14 14:42:05 EDT
Build Identifier: M20080911-1700

When using org.eclipse.swt.custom.PopupList, their is no method or argument in the constructor to set the style of the List widget. More importantly I can't set the SWT.H_SCROLL style on the List widget, it only has SWT.V_SCROLL.

This bug is blocking a core feature in our product where the customer cannot see the list of values if the values are very long. Even the tooltip doesn't wrap.

Reproducible: Always

Steps to Reproduce:
1. Look in the constructor of org.eclipse.swt.custom.PopupList
2. Notice when it instantiates the List widget it hardcodes the style with no SWT.H_SCROLL
Comment 1 Felipe Heidrich CLA 2010-05-14 15:19:42 EDT
After 3.6
New API are not permitted at this time. Sorry.
Comment 2 Grant Gayed CLA 2010-05-27 16:23:50 EDT
Lakshmi, talk to SSQ before doing anything here since API could be involved.
Comment 3 Lakshmi P Shanmugam CLA 2010-08-13 06:02:55 EDT
Created attachment 176534 [details]
patch-1

When the user sets SWT.H_SCROLL in the style of the PopupList, the List will be created with SWT.H_SCROLL.
Comment 4 Lakshmi P Shanmugam CLA 2010-08-13 06:05:01 EDT
Test case:
public class PopupListExample1 {
	public static void main(String[] args) {
		Display display = new Display();
		final Shell shell = new Shell(display);
		shell.setLayout(new RowLayout());
		Button button = new Button(shell, SWT.PUSH);
		button.setText("show popup");
		button.addSelectionListener(new SelectionAdapter() {
			public void widgetSelected(SelectionEvent e) {
				PopupList list = new PopupList(shell, SWT.H_SCROLL);
				list.setItems(new String[] {"veryveryveryveryveryveryloooooooooongtext", "jojo", "lk", "k", "l", "op", "opop", "text"});
				list.open(shell.getBounds());
			}
		});
		shell.pack();
		shell.open();
		while (!shell.isDisposed()) {
			if (!display.readAndDispatch())
				display.sleep();
		}
		display.dispose();
	}
}
Comment 5 Lakshmi P Shanmugam CLA 2010-08-13 11:00:24 EDT
SSQ, can you please review?
Comment 6 Silenio Quarti CLA 2010-08-13 13:42:01 EDT
Looks good.
Comment 7 Lakshmi P Shanmugam CLA 2010-08-16 03:50:17 EDT
Fixed in HEAD > 20100816.