Community
Participate
Working Groups
The List widget has no showSelection method in RWT
Created attachment 142984 [details] Proposed patch
(In reply to comment #1) > Created an attachment (id=142984) [details] > Proposed patch > I found the following two issues, while testing the patch: 1. If showSelection() is called before the List is shown (see the snippet below), the list is not scrolled to the selected item. This works in RCP. 2. Calling list.setBounds() before list.showSelection() produces the following error: Could not evaluate javascript response: qx.ui.form.ListItem: Element must be created previously! === test snippet === public class Application implements IEntryPoint { public int createUI() { Display display = new Display(); Shell shell = new Shell( display ,SWT.NONE); final List list = new List (shell, SWT.BORDER | SWT.V_SCROLL); for (int i=0; i<100; i++) list.add ("Item " + i); list.select( 60 ); list.showSelection(); list.setBounds (0, 0, 100, 100); shell.pack (); shell.open(); while( !shell.isDisposed() ) { if( !display.readAndDispatch() ) { display.sleep(); } } return 0; } }
This bug blocks Bug 277678
Created attachment 143147 [details] Proposed patch This version of the patch fixes the issues, explained in comment #2.
(In reply to comment #4) > Created an attachment (id=143147) [details] > Proposed patch > > This version of the patch fixes the issues, explained in comment #2. > The patch is an improvement. It fixes issue #2, but issue #1 is not fully resolved. Referring to the code in comment 2 - the selected element will be revealed if the method calls are ordered like this: ... list.setBounds (0, 0, 100, 100); list.showSelection(); ... If the calls are reordered, the view will not be scrolled to the selected item. In SWT, both cases work.
Applied patch to CVS HEAD with some minor changes (variable names). Added several testcases in List_Test