[squeak-dev] PluggableListMorph>>mouseUp: sets index to 0

Ross Boylan ross at biostat.ucsf.edu
Fri Jun 13 01:12:32 UTC 2008


PluggableListMorph>>mouseUp:
mouseUp: event 
	"The mouse came up within the list; take appropriate action"
	
	| row mdr |
	row := self rowAtLocation: event position.
	event hand hasSubmorphs ifFalse: [
		mdr := self mouseDownRow.
		 self mouseDownRow: nil.
		mdr ifNil: [^self]].
	(self enabled and: [model okToChange])
		ifFalse: [^ self].
	"No change if model is locked or receiver disabled"
	row == self selectionIndex
		ifTrue: [(autoDeselect ifNil: [true]) ifTrue:[row == 0 ifFalse: [self
changeModelSelection: 0 "!!!!"] ]]
		ifFalse: [self changeModelSelection: row].
	Cursor normal show

I marked the spot with "!!!!".  This leads to the index setter being
called with argument 0 on the underlying model, which produces an error.

I could code around this, but is this supposed to be the way things
work?

The context for this was that I had clicked on a row that was already
selected.  I *did* want the selection to be communicated back to the
model; the row was selected by default, and the user click indicated it
was the right selection.

The PluggableListMorph (actually, PluggableListMorphPlus, but that's not
where the method is implemented) was built by ToolBuilder.

Ross



More information about the Squeak-dev mailing list