[squeak-dev] The Trunk: ToolBuilder-Morphic-TheresaHMartenK.261.mcz

commits at source.squeak.org commits at source.squeak.org
Thu Oct 1 13:55:09 UTC 2020


Marcel Taeumel uploaded a new version of ToolBuilder-Morphic to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-Morphic-TheresaHMartenK.261.mcz

==================== Summary ====================

Name: ToolBuilder-Morphic-TheresaHMartenK.261
Author: TheresaHMartenK
Time: 20 June 2020, 4:04:09.471561 pm
UUID: ec0bd065-4cc8-7d48-b940-4bf5a0f4a7cf
Ancestors: ToolBuilder-Morphic-mt.260

The current implementation searches for the supplied answer in the valueList and if found returns the value at the found index in the valueList which of course is the supplied answer. However from the behaviour that gets mimicked you would expect the implementation to look for the suppliedAnswer in the labelList - the same as you click on the label and not on its connected value. Additionally this produces less readable / understandable code compared to supplying the label, especially if the value happens to be a block.

With the new implementation, the answer is searched in the labelList, and the returned value is the coresponding value from the valueList.

=============== Diff against ToolBuilder-Morphic-mt.260 ===============

Item was changed:
  ----- Method: MorphicUIManager>>chooseFrom:values:lines:title: (in category 'ui requests') -----
  chooseFrom: labelList values: valueList lines: linesArray title: aString 
  	"Choose an item from the given list. Answer the selected item."
  	
  	| index |
  	self askForProvidedAnswerTo: aString ifSupplied: [:answer | 
  		(answer = #cancel or: [answer isNil]) ifTrue: [^ nil].
+ 		^ valueList at: (labelList indexOf: answer) ifAbsent: [
- 		^ valueList at: (valueList indexOf: answer) ifAbsent: [
  				answer isNumber 
  					ifTrue: [valueList at: answer ifAbsent: [nil]]
  					ifFalse: [nil]]].
  	
  	index := self chooseFrom: labelList lines: linesArray title: aString.
  	^ index = 0
  		ifTrue: [ nil ]
  		ifFalse: [ valueList at: index ]!



More information about the Squeak-dev mailing list