[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.platform.swt] Re: Controls on ScrolledComposite 'guzzles' events

I've putted some Controls (Labels/Buttons) inside a ScrolledComposite/ Composite-pair. As long as the mouse cursor is e.g. directly over the scroll-bar everything is fine, but when I roll the MouseWheel and the Cursor is positioned above a control, scrolling stops. :-/

Hello,

I could narrow the effect down to preceding Controls within a Layout: If you leave "Button malicious1" in my following example untouched, mentioned effect will occour. If you delete line containing "Button malicious1" everything will work correctly as expected (see Snippet5 from dev.eclipse.org).

It would be nice, if someone can confirm this bug. (At least I consider this as a bug, but hopefully I just did something wrong)

----

import org.eclipse.swt.*;
import org.eclipse.swt.widgets.*;
import org.eclipse.swt.layout.*;
import org.eclipse.swt.custom.*;

public class ModifiedSnippet5 {

    public static void main (String [] args)
    {
        Display display = new Display ();
        Shell shell = new Shell (display);
        shell.setLayout(new FillLayout());

        Button malicious1 = new Button (shell, SWT.PUSH);

        ScrolledComposite cOuter = new ScrolledComposite (
        	shell, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);

        Composite cInner = new Composite(cOuter, SWT.BORDER);
        cInner.setLayout(new GridLayout());

        Button b1 = new Button (cInner, SWT.PUSH);

        b1.setText("wheel freezing button");
        b1.setBounds (10, 10, 40, 40);

        cInner.setSize (400,400);

        cOuter.setContent(cInner);

        Button malicious2 = new Button (shell, SWT.PUSH);

        shell.setSize(600, 300);
        shell.open ();
        while (!shell.isDisposed ()) {
            if (!display.readAndDispatch ()) display.sleep ();
        }
        display.dispose ();
    }

}

A

--