[Pharo-project] Problem with popup lists (Senders of, implementors of etc.)

Stéphane Ducasse stephane.ducasse at inria.fr
Mon Oct 4 13:26:31 EDT 2010


Thanks this is my mistake....
I will integrate it now.

On Oct 4, 2010, at 12:57 PM, Gary Chambers wrote:

> Hi.
>  
> Since the update to 12168 I am getting an MNU...
> Tracked down to
>  
> showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption
>  "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters.  Use aCaption as the menu title, if it is not nil.  Evaluate choiceBlock if a message is chosen."
>  
>  | index menuLabels sortedList |
>  sortedList := selectorCollection asSortedCollection.
>  menuLabels := Array streamContents: 
>   [:strm | strm nextPutAll: (firstItem contractTo: 40).
>   sortedList do: [:sel | strm nextPutAll: (sel contractTo: 40)]].
>  index := UIManager default chooseFrom: (menuLabels substrings) lines: #(1).
>  index = 1 ifTrue: [choiceBlock value: firstItem].
>  index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]
>  
> The following revision seems to work ok...
>  
>  
> showMenuOf: selectorCollection withFirstItem: firstItem ifChosenDo: choiceBlock withCaption: aCaption
>  "Show a sorted menu of the given selectors, preceded by firstItem, and all abbreviated to 40 characters.  Use aCaption as the menu title, if it is not nil.  Evaluate choiceBlock if a message is chosen."
>  
>  | index menuLabels sortedList |
>  sortedList := selectorCollection asSortedCollection.
>  menuLabels := Array streamContents: 
>   [:strm | strm nextPut: (firstItem contractTo: 40).
>   sortedList do: [:sel | strm nextPut: (sel contractTo: 40)]].
>  index := UIManager default chooseFrom: menuLabels lines: #(1).
>  index = 1 ifTrue: [choiceBlock value: firstItem].
>  index > 1 ifTrue: [choiceBlock value: (sortedList at: index - 1)]
> 
> Regards, Gary
> _______________________________________________
> Pharo-project mailing list
> Pharo-project at lists.gforge.inria.fr
> http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project





More information about the Pharo-dev mailing list