Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » SWT Drop Target Problem on Linux(DropTarget Area not correctly drawn on gtk ?)
SWT Drop Target Problem on Linux [message #1710967] Mon, 12 October 2015 05:26
Christian Ora is currently offline Christian OraFriend
Messages: 20
Registered: May 2014
Junior Member
Hi There,

First of all, sorry for off-topic since this is jface and not pure swt, but i'm desperate enough to place my question here.(If you know another appropriate place to ask, feel free to link it).

I have a scrolled composite, within the scrolled composite, there is a composite with a grid layout. Within this composite there a 3x7 Buttons defined as DropTargets. In the first row of Buttons there are always 2-3 Buttons which do not function as drop targets(The DropTargetListener doesn't activate on drop), but after a resize of the window, they do !

I'm familiar to swt but i've never encountered this behaviour before. I believe this might be related to the gtk version (It's used on centos 6.2, and its java 1.6)

Here is the sample code:

GridData scGridData = new GridData(SWT.FILL, SWT.FILL, true, true);
        scGridData.horizontalSpan = 2;
        sc = new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL | SWT.BORDER);
        Composite composite = new Composite(sc, SWT.NONE);

        GridLayout layout = new GridLayout(7, true);
       GridData lgridData = new GridData(SWT.CENTER, SWT.CENTER, true,     true);    
        int numkeys = 21;
        for (int i = 0; i < numkeys; i++) {
            final Button button = new Button(composite, SWT.NONE);
            button.setText("SomeText: " + i);
            DropTarget dropTarget = new DropTarget(button, SWT.NONE);
            dropTarget.setTransfer(new Transfer[]{TextTransfer.getInstance()});
            dropTarget.addDropListener(new DropTargetAdapter() {
                public void drop(DropTargetEvent event) {
                    System.out.println("Drop: " +;
                    button.setText((String) ObjectTransfer.getInstance().getData());
            GridData gridData = new GridData(0, 0, true, true);
            gridData.widthHint = 100;
            gridData.heightHint = 100;


        sc.setMinSize(composite.computeSize(SWT.DEFAULT, SWT.DEFAULT));

Any idea is appreciated !
Previous Topic:selectionChanged event not triggered after opening EditPart from TreeView
Next Topic:connected lists widget
Goto Forum:

Current Time: Mon Apr 19 19:32:24 GMT 2021

Powered by FUDForum. Page generated in 0.01717 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top