| Summary: | Tree selection in Cocoa jumps to another item when the dialog resizes | ||
|---|---|---|---|
| Product: | [Eclipse Project] Platform | Reporter: | Anirudh Sasikumar <anirudhsasikumar> |
| Component: | SWT | Assignee: | Scott Kovatch <skovatch> |
| Status: | RESOLVED FIXED | QA Contact: | Silenio Quarti <Silenio_Quarti> |
| Severity: | normal | ||
| Priority: | P3 | CC: | mayankk, mschrag, pinnamur, rvonmassow, Silenio_Quarti, skovatch |
| Version: | 3.6 | ||
| Target Milestone: | 4.3 M4 | ||
| Hardware: | Macintosh | ||
| OS: | Mac OS X | ||
| Whiteboard: | |||
|
Description
Anirudh Sasikumar
This happens because we are sending a selection event during the outlineViewSelectionIsChanging notification. The dialog resizes and then the NSOutlineView continues to track the mouse. My guess is that the enlargement of the dialog makes the outline view think a different row was clicked, hence the selection changing notification. Silenio, why are we listening to both the selectionIsChanging and selectionChanged events? Carbon only sent a selection event when the click finished. I haven't tried Windows to see if this is a consistency thing. If I comment out the code in outlineViewSelectionIsChanging this bug goes away, but I want to check before I change that. (In reply to comment #1) > Silenio, why are we listening to both the selectionIsChanging and > selectionChanged events? Carbon only sent a selection event when the click > finished. I haven't tried Windows to see if this is a consistency thing. Answering my own question... This is because you can drag-select in an NSOutlineView/NSTableView. Every time you move over an item you get an outlineViewSelectionIsChanging event. Reacting to that event isn't necessarily normal/expected behavior. See Xcode's help window, for example. It would be nice if we could make that configurable. We listen for selectionIsChanging to have the same ordering of events of the other platforms (SWT.MouseDown, SWT.Selection, SWT.MouseUp). The selectionChanged event comes after mouse up on cocoa. I'm no longer seeing this bug on I20101208-1300. I know that mouse event generation changed in this area, but I'm not sure exactly what fix did it. To be honest, I think this problem still exists. In our framework we build a toolbar according to the selection in a tree below the toolbar. The visual design may in some cases cause a line wrap in the toolbar (I didn't do the GUI design and I'm not a fan of that). If the line wraps and the tree is moved down by the line wrap, another node will be selected. The selection of the other node causes the toolbar to be rebuilt again. Currently I work around the problem by registering a filter on the SWT display and drop the second selection event and then adjusting the selection in the tree in turn (the wrong item will be marked selected otherwise). This is a really dirty hack but was the only solution I could come up with. |