Found a bug in keeping the initial selections in a ChoicePrompter. Or at
least I'm pretty sure that it's a bug. I'm open to there being a better
way to do what I'm trying to accomplish.
As illustrated in the attached script, a problem arises when setting the
#getTextBlock: for a ChoicePrompter. The #refreshContents called in
#getTextBlock: ends up killing the selection which causes the second
assert to fail.
The fix I came up with was to have ListView>>getTextBlock: save and
restore the selections. There's probably a better way to deal with the
problem, but I'll leave that to OA. Looks like #getImageBlock: would
have the same issue.
-Bill
------------------
prompter := ChoicePrompter
createOn: #(one three)
multipleChoices: #(one two three four)
caption: nil.
self assert: [(prompter view viewNamed: 'choices') selectionsByIndex =
#(1 3)].
prompter getTextBlock: [:each | each asUppercase].
self assert: [(prompter view viewNamed: 'choices') selectionsByIndex =
#(1 3)].
prompter showModal.
-------------------
!ListView methodsFor!
getTextBlock: aOneArgBlock
| savedSelections |
savedSelections := lastSelIndices.
super getTextBlock: aOneArgBlock.
self basicSelectionsByIndex: savedSelections! !
-------------------------------------------
Bill Dargel
[hidden email]
Shoshana Technologies
100 West Joy Road, Ann Arbor, MI 48105 USA