|
Re: [REPOST] Maybe List control bug ? [message #459156 is a reply to message #458797] |
Tue, 02 August 2005 14:22  |
Eclipse User |
|
|
|
https://bugs.eclipse.org/bugs/show_bug.cgi?id=104992
"Robert Bacs" <boby@zerosoft.ro> wrote in message
news:dbog2i$thk$1@news.eclipse.org...
> Hi,
>
> I have two list controls on a sashform and I want to show the selected
item
> even after the list control is resized. I've added a resize listener to
both
> list control and called showSelection() method. In some situation the list
> items are doubled, see attached image.
>
>
> import org.eclipse.swt.SWT;
> import org.eclipse.swt.custom.SashForm;
> import org.eclipse.swt.layout.FillLayout;
> import org.eclipse.swt.widgets.Display;
> import org.eclipse.swt.widgets.Event;
> import org.eclipse.swt.widgets.List;
> import org.eclipse.swt.widgets.Listener;
> import org.eclipse.swt.widgets.Shell;
>
>
> /**
> * @author Robert Bacs
> */
> public class ListTest {
> public static void main (String [] args) {
> final Display display = new Display ();
> final Shell shell = new Shell (display);
> shell.setLayout(new FillLayout());
>
> SashForm sashForm = new SashForm(shell, SWT.VERTICAL);
>
> final List list1 = new List(sashForm, SWT.BORDER | SWT.H_SCROLL |
> SWT.V_SCROLL);
> for (int i = 1; i <= 10; i++){
> list1.add("Item" + i);
> }
> list1.addListener(SWT.Resize, new Listener(){
> public void handleEvent(Event event) {
> list1.showSelection();
> list1.update();
> }
> });
> List list2 = new List(sashForm, SWT.BORDER | SWT.H_SCROLL |
SWT.V_SCROLL);
> for (int i = 1; i <= 10; i++){
> list2.add("Item" + i);
> }
>
> shell.pack ();
> shell.open ();
> shell.layout();
> while (!shell.isDisposed ()) {
> if (!display.readAndDispatch ()) display.sleep ();
> }
> display.dispose ();
> }
> }
>
>
>
|
|
|
Powered by
FUDForum. Page generated in 0.03236 seconds