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

Bug 320985

Summary: DropTarget inside an ExpandBar doesn't work
Product: [Eclipse Project] Platform Reporter: mik01aj <mik01aj>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: RESOLVED WORKSFORME QA Contact:
Severity: minor    
Priority: P3 CC: ericwill, pinnamur
Version: 3.5.1Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:

Description mik01aj CLA 2010-07-27 04:54:03 EDT
import org.eclipse.swt.SWT;
import org.eclipse.swt.dnd.DropTarget;
import org.eclipse.swt.dnd.FileTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.ExpandBar;
import org.eclipse.swt.widgets.ExpandItem;
import org.eclipse.swt.widgets.Shell;

public class Snippet223 {

public static void main (String [] args) {
    Display display = new Display ();
    Shell shell = new Shell (display);
    shell.setLayout(new FillLayout());
    shell.setText("ExpandBar Example");
    ExpandBar bar = new ExpandBar (shell, SWT.V_SCROLL);

    Button b1 = new Button (bar, SWT.PUSH);
    b1.setText("Button1");
    DropTarget dt = new DropTarget(b1, 0);
    dt.setTransfer(new Transfer[] { FileTransfer.getInstance() });

    ExpandItem item0 = new ExpandItem (bar, SWT.NONE);
    item0.setText("Blah");
    item0.setHeight(b1.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
    item0.setControl(b1);
    item0.setExpanded(true);

    Button b2 = new Button (shell, SWT.PUSH);
    b2.setText("Button2");
    dt = new DropTarget(b2, 0);
    dt.setTransfer(new Transfer[] { FileTransfer.getInstance() });

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

}

----------------------------------------------------------------

Check out the following code. Both buttons have a DropTarget, but only the second one reacts to dragging anything above it. (Looks like it's a problem with ExpandBar)
Comment 1 Eric Williams CLA 2018-05-15 15:01:44 EDT
I cannot reproduce the issue on GTK3.22, 4.8 M7, and Fedora 28.