Community
Participate
Working Groups
- eclipse-SDK-3.2-win32.zip - Windows XP - Sun JDK 1.5.0 Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64) Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode) Clicking on + then - in a tree view ignores successive clicks if they are less than about half a second apart. This is not a problem in native Windows (Windows explorer, for example). Fixing this makes applications seem more responsive and improves the user experience. One example scenario would be missing with the mouse and expanding the wrong tree, then collapsing it immediately to expand the right one. To reproduce: - Start Eclipse 3.2 - Create a Java project, or go to Window->Show View->Other... - Rapidly click on the +/- to expand and collapse a tree. Notice how rapid successive clicks are ignored.
SWT, what are we doing wrong? Snippet15 seems to behave like the Windows Explorer: Double clicking on a tree item expands it, but double clicking on the + expands on the first click and collapses on the second click, even if the item moved as a result of the expand so that the second click does not actually happen on the item.
You are hooking SWT.DoubleSelection which means that you are providing the actaion when a user double clicks on an item. This disables the expand/collapse behavior of a tree item (otherwise, the expand/collapse would happen, then your double selection action would run and that would be confusing). Am I missing something?
Are you overriding the operating system default and expand/collapsing the node yourself? If so, you are probably seeing XP animation that is slowing down the operation. Try turning it off to see.
This is a bug in the SWT Tree control (win32). As soon as the first listener is registered for SWT.DefaultSelection, doubleclicks on the "+" or "-" don't work any more. This can easily be reproduced in the Control Example by adding such a listener to the Tree control. With the SWT.DefaultSelection installed, doubleclicking on "+" only expands a tree item, but does *not* send out a DefaultSelection event. Tree#wmNotifyChild(..): [..] case OS.NM_DBLCLK: { if (hooks (SWT.DefaultSelection)) return LRESULT.ONE; break; } [..] => Should not return LRESULT.ONE if the click target was the "+" / "-" box and not the item.
Is the behavior that you want for double clicking to expand and then collapse the tree right away? Seems useless, but correct.
It would make applications written using SWT feel more responsive. From comment#0: One example scenario would be missing with the mouse and expanding the wrong tree, then collapsing it immediately to expand the right one.
> Is the behavior that you want for double clicking to expand and then collapse > the tree right away? Seems useless, but correct. Exactly. Actually, I need less time than the default doubleclick delay to realize that I expanded the wrong node. BTW: Under GTK, this already works as expected.
Fixed > 20070122
Thanks, works perfect in I20070123-1715.