[squeak-dev] Morphic yellow cross of death
Bob Arning
arning315 at comcast.net
Tue Sep 17 22:12:12 UTC 2013
Well, this I can reproduce.
So if we look at this puppy:
========================================
!PluggableListMorphOfMany methodsFor: 'event handling' stamp: 'raa
9/17/2013 18:02'!
mouseMove: event
"The mouse has moved, as characterized by the event provided.
Adjust the scrollbar, and alter the selection as appropriate"
| oldIndex oldVal row index bobsDebugging |
bobsDebugging _ OrderedCollection new.
bobsDebugging add: {'1'. dragOnOrOff}.
event position y < self top
ifTrue:
[scrollBar scrollUp: 1.
row := self rowAtLocation: scroller topLeft + (1 @ 1)]
ifFalse:
[row := event position y > self bottom
ifTrue:
[scrollBar scrollDown: 1.
self rowAtLocation: scroller bottomLeft + (1 @ -1)]
ifFalse: [ self rowAtLocation: event position]].
row = 0 ifTrue: [^super mouseDown: event].
index := self modelIndexFor: row.
model okToChange ifFalse: [^self]. "No change if model is locked"
bobsDebugging add: {'2'. dragOnOrOff}.
dragOnOrOff ifNil:
["Was not set at mouse down, which means the mouse must
have gone down in an area where there was no list item"
dragOnOrOff := (self listSelectionAt: index) not].
bobsDebugging add: {'3'. dragOnOrOff}.
"Set meaning for subsequent dragging of selection"
oldIndex := self getCurrentSelectionIndex.
oldIndex ~= 0 ifTrue: [oldVal := self listSelectionAt: oldIndex].
"Set or clear new primary selection (listIndex)"
dragOnOrOff
ifTrue: [self changeModelSelection: index]
ifFalse: [self changeModelSelection: 0].
"Need to restore the old one, due to how model works, and set new one."
oldIndex ~= 0 ifTrue: [self listSelectionAt: oldIndex put: oldVal].
bobsDebugging add: {'4'. dragOnOrOff}.
self listSelectionAt: index put: dragOnOrOff.
! !
==========================================
I added some debugging code which reports
an OrderedCollection(#('1' false) #('2' false) #('3' false) #('4' nil))
So we clobbered dragOnOrOff between the 3rd and 4th entries in the list.
That's happening because of:
============================================
!PluggableListMorph methodsFor: 'model access' stamp: 'kb 6/5/2013 21:12'!
changeModelSelection: anInteger
" Change the model's selected item index to be anInteger. Enable
the pre selection highlight. Step the World forward to let the pre
selection highlight take effect. "
self rowAboutToBecomeSelected: (self uiIndexFor: anInteger).
World doOneCycle.
setIndexSelector ifNotNil: [
model perform: setIndexSelector with: anInteger ].! !
=============================================
The World doOneCycle permits another ui event to be processed while we
are still in the mouseMove:. If the event is a mouseUp: then
mouseUp: event
dragOnOrOff := nil. "So improperly started drags will have not effect"
kaboom.
Cheers,
Bob
On 9/17/13 4:26 PM, Nicolas Cellier wrote:
> Ah, sorry, it was not a debugger, it was a ChangeList, and curiously,
> the listSelections effectively contains a non boolean (nil)
> #(false false false true true nil true false false false false false
> false false false false false)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20130917/b1384bf9/attachment.htm
More information about the Squeak-dev
mailing list
|