Ok, I like the way you use it.
Now, I hope to have in future a better menu tool.

Jannik

On Mar 12, 2013, at 4:23 PM, stephane ducasse <[email protected]> wrote:

> Jannik 
> 
> I'm studying right now choose…
> So I think that I will add a method add: value: to the instance side to see 
> how it look like.
> 
> Stef
> 
> 
> chooseFrom: aList lines: linesArray title: queryString
>       "Choose an item from the given list. Answer the index of the selected 
> item."
>       "MenuMorph
>               chooseFrom: #('Hello' 'Pharoers' 'Here' 'We' 'Go')
>               lines: #(2 4)
>               title: 'What''s up?'"
>               
>       | menu result |
>       (ProvideAnswerNotification signal: queryString) ifNotNil:[:answer | 
>               1 to: aList size do:[:i| (aList at: i) = answer ifTrue:[^i]].
>               ^0].
>       result := 0.
>       menu := self new.
>       menu addTitle: queryString.
>       1 to: aList size do:[:i| 
>               menu add: (aList at: i) asString target: [:v| result := v] 
> selector: #value: argument: i.
>               (linesArray includes: i) ifTrue: [menu addLine]].
>       
>       menu invokeAt: ActiveHand position in: ActiveWorld allowKeyboard: true.
>       ^result


Reply via email to