One of the small annoyances in VisualWorks is the way selection works with listboxes when you set them for:

Select on (mouse button) down (the normal way to do it)

Set up the listbox for multiple selections

Want the user to be able to select mutiple items, come back, and then drag the previously selected group

That last thing is what doesn't work out of the box - instead, when you first click the left button, the selected group is de-selected, and the one thing you were pointing at when you wanted to do a drag operation becomes the new selection.

As you might guess, given the way most end user tools now work, end users are not entirely pleased with this turn of events. So... It was off to controller land. A few minutes of investigation told me that multi-selection listboxes use the class EmulatedSequenceController, and I started trawling through the code.

Now, other than patching some of the more egregious flaws in the way Datasets work, I haven't done a lot of hacking on controllers. So it took me a bit of rathole diving before I realized that the problem was in EmulatedSequenceTracker, which works in conjunction with the controller. If you look at the #redButtonPressedEvent: method there (with a flashback to Xerox mice tossed in), you find that you end up calling down to #setUpDragDropFor:

The problem resides in the first statement in the block - the controller is told to toggle the selection, and it dutifully does so. It's only later in the call chain that drag/drop is checked for, by which time the selection has been reset. So... I hacked up three methods in EmulatedSequenceController to make that happen on red button up instead of on red button down - note the extra checks for whether we want to drag or not; without that, you get some truly weird behavior:

In the button release method, I copied over both lines from the block in #setUpDragDropFor:. After that, things worked the way I wanted them to - with multiple selections only deselecting on mouse button up. Kind of amusing that such a small fix took me most of the day to track down, but there you go :)