The Trunk: ToolBuilder-MVC-TheresaHMartenK.60.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: ToolBuilder-MVC-TheresaHMartenK.60.mcz

commits-2
Marcel Taeumel uploaded a new version of ToolBuilder-MVC to project The Trunk:
http://source.squeak.org/trunk/ToolBuilder-MVC-TheresaHMartenK.60.mcz

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

Name: ToolBuilder-MVC-TheresaHMartenK.60
Author: TheresaHMartenK
Time: 20 June 2020, 4:32:44.419561 pm
UUID: ce7849e7-d47c-434e-8bbd-f6ec2b896a4c
Ancestors: ToolBuilder-MVC-mt.59

Same reason as: ToolBuilder-Morphic-TheresaHMartenK.261

Copy:
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-MVC-mt.59 ===============

Item was changed:
  ----- Method: MVCUIManager>>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."
  | menu |
  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]]].
 
  menu := SelectionMenu labels: labelList lines: linesArray selections: valueList.
  ^ aString
  ifEmpty: [menu startUp]
  ifNotEmpty: [menu startUpWithCaption: aString]!