+1 for me
I had exactly the same experience with DropLists

Le 9 août 2012 à 20:14, Sean P. DeNigris a écrit :

> 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.
> 


Reply via email to