Hi Stef,
I am searching to do that too.
For now, I am using something else... And I plan to create new Menu more
usable.
Here is what I use, for your case, just adapt it when trying:
===
| aMenu sz on |
on := soundInput isRecording.
self stop.
aMenu := MenuMorph new title: ('FFT size (currently {1})'
translated format:{fft n}).
((7 to: 10) collect: [:n | 2 raisedTo: n]) do: [:r |
aMenu add: r printString
target: FFT
selector: #new
argument: r
].
aMenu popUpInWorld.
self resetDisplay.
on ifTrue: [self start].
===
Jannik
2013/3/11 stephane ducasse <[email protected]>
> In fact I see that the problem is more into
>
> how can I specify a menu item which returns a value that I specify without
> passing a symbol
>
> ((7 to: 10) collect: [:n | 2 raisedTo: n]) do: [:r | aMenu
> add: r printString action: r].
>
>
> On Mar 11, 2013, at 1:28 PM, Stéphane Ducasse <[email protected]>
> wrote:
>
> > HI guys
> >
> > I'm trying to fix all the sound interface for 2.0 and I got trapped into
> MenuMorph. How do I schedule a menu and get its selected value?
> > I have to convert code like the following one.
> >
> >
> >
> > | aMenu sz on |
> > aMenu := MenuMorph new title: ('FFT size (currently {1})'
> translated format:{fft n}).
> > ((7 to: 10) collect: [:n | 2 raisedTo: n]) do: [:r | aMenu add: r
> printString action: r].
> >
> > sz := aMenu popUpInWorld.
> > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > how can I get the selected value?
> >
> >
> > sz ifNil: [^ self].
> > on := soundInput isRecording.
> > self stop.
> > fft := FFT new: sz.
> > self resetDisplay.
> > on ifTrue: [self start].
> >
> >
>
>
>
--
~~Dr. Jannik Laval~~
École des Mines de Douai
Enseignant-chercheur
http://www.jannik-laval.eu