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

Bug 81759

Summary: Can't select tool items when tool bar has a DragDetect listener
Product: [Eclipse Project] Platform Reporter: Brock Janiczak <brockj>
Component: SWTAssignee: Billy Biggs <billy.biggs>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: P3 CC: dirk_baeumer, snorthov
Version: 3.1   
Target Milestone: 3.1 M5   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Brock Janiczak CLA 2004-12-21 17:41:42 EST
Version: 3.1.0
Build id: 200412210800

Clicking on the buttons of the perspective or fast view bar does nothing. 
Instead of opening a view/perspective, it looks like it is attempting to start a
drag operation.  The click after pressing the button is ignored and if you click
and drag after pressing a button you get a "no go" cursor.

You can work around this by opening the views/perspectives using the menu.
Comment 1 Kim Horne CLA 2004-12-21 17:55:41 EST
Is there anything of interest in your log?
Comment 2 Brock Janiczak CLA 2004-12-21 18:13:31 EST
sorry, i should have mentioned the logs :)

There were no errors at all in the logs.

I will try installing it again with a new workspace and see if that fixes it. 
The only interesting thing that happed was that i got a 'could not resore
layout' error because of a missing feature (so i had a missing perspective)
Comment 3 Brock Janiczak CLA 2004-12-21 18:31:14 EST
new config/workspace didn't fix the problem... but the problem doesn't show up
under a runtime workbech!

I will try remotely debugging the workbench and see if i can find anything
Comment 4 Brock Janiczak CLA 2004-12-21 19:40:52 EST
This is starting to look like an SWT bug.  WM_COMMAND does not seem to be fired
for the buttons at all.

I tried to reproduce the error with a small (SWT only) code fragment but could
only reproduce part of the problem.  The selection event was always sent, but
the button click doesn't show unless you double click.

public class Issue81759 {

    public static void main(String[] args) {
        Display d = Display.getDefault();
        Shell s = new Shell(d, SWT.CLOSE);
        s.setLayout(new FillLayout());
        
        Composite c = new Composite(s, SWT.NONE);
        c.setLayout(new FillLayout());
        
        
        ToolBar tb = new ToolBar(s, SWT.NONE);
        ToolItem ti = new ToolItem(tb, SWT.PUSH);
        ti.setText("press me");

        ti.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent e) {
                System.err.println("Button selected");
            }
        });
        
        tb.addListener(SWT.MenuDetect, new Listener() {
            public void handleEvent(Event event) {

            }
        });
        
        // This causes the button to not show it is being pressed.  Shows for
double click though
        tb.addListener(SWT.DragDetect, new Listener() {public void
handleEvent(Event event) {}});

        s.open();
        
        while (!s.isDisposed()) {
            if (d.readAndDispatch()) {
                d.sleep();
            }
        }
    }
}
Comment 5 Brock Janiczak CLA 2004-12-21 21:32:39 EST
You have to be running with the manifest file for it to happen (that is why it
worked in the runtime workbench).  The fragment in comment 4 now shows the
behaviour i am seeing in the workbench.  Ignore the menu detect listener, it
shouldn't be there.

For the record, I am running version 5.82.2900.2180 of comctrl32.dll.  I am
using the xp manifest and use the classic theme.

Updating the summary and moving to SWT since this doesn't seem to be a platform
UI problem.
Comment 6 Brock Janiczak CLA 2004-12-21 22:00:46 EST
could this be caused by the fix to bug 79216?
Comment 7 Kim Horne CLA 2004-12-22 06:31:13 EST
*** Bug 81777 has been marked as a duplicate of this bug. ***
Comment 8 Dirk Baeumer CLA 2004-12-22 11:00:59 EST
Raising severity since the bug renders makes the build almost unusable.
Comment 9 Billy Biggs CLA 2004-12-22 11:35:31 EST
Fixed > 20041222.
Comment 10 Billy Biggs CLA 2004-12-22 11:38:14 EST
This was caused by the fix for bug 79216.