Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320985 - DropTarget inside an ExpandBar doesn't work
Summary: DropTarget inside an ExpandBar doesn't work
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: SWT (show other bugs)
Version: 3.5.1   Edit
Hardware: PC Linux
: P3 minor with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform-SWT-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords: triaged
Depends on:
Blocks:
 
Reported: 2010-07-27 04:54 EDT by mik01aj CLA
Modified: 2018-05-15 15:01 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.