[Pharo-project] Spec DropLists

Stéphane Ducasse stephane.ducasse at inria.fr
Fri Aug 10 09:20:10 CEST 2012


Thanks sean

Ben is on holidays for two weeks. So I imagine that he will not read the mailing-list.

Stef

On Aug 9, 2012, at 8:14 PM, Sean P. DeNigris wrote:

> Issue 6551: [ENH Spec]: Spec-ify DropListModel
> http://code.google.com/p/pharo/issues/detail?id=6551
> 
> Currently:
> 	self instantiateModels: #(dropList #DropListModel).
> 	
> 	item1 := DropListItem named: 'Red morph' do: self redMorphBlock.
> 	item2 := DropListItem named: 'Blue morph' do: self blueMorphBlock.
> 	item3 := DropListItem named: 'Green morph' do: self greenMorphBlock.
> 	
> 	dropList items: {item1. item2. item3}.
> 
> I'd prefer if DropLists were uniform with the rest of Spec, namely:
>  I'd have my domain class
>  MyColor>>description
>    ^ nameOfColor
> 
>  dropList
>    items: {myRedColor. myBlueColor. myGreenColor};
>    displayBlock: [ :e | e description, ' morph' ];
>    whenSelectionChanged: [ :e | self showMorphFor: e ].
> 
> I'd prefer not to even know that DropListItem exists, and have the model
> take care of it for me. Something like:
>  DropListModel>>items: aList
> 	"Populate the drop list with a list of objects"
> 	
> 	| items |
> 	items := aList collect: [ :e | DropListItem named: e printString do: [  ]
> ].
> 	listHolder contents: items.
> 
> Incidentally, #whenSelectionChanged: exists for DropListModels, but is
> broken. When an item is chosen from the drop list, the announcement received
> by this block has both new and old contents set to nil:
> Issue 6550: [BUG Spec]: DropListModel>>whenSelectionChanged:
> http://code.google.com/p/pharo/issues/detail?id=6550
> 
> Cheers,
> Sean
> 
> 
> 
> --
> View this message in context: http://forum.world.st/Spec-DropLists-tp4643694.html
> Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
> 




More information about the Pharo-project mailing list