Forums > MaxMSP

How to detect "state" of a menu item?

September 20, 2012 | 1:01 am

Hi,

I’m a relative newb trying to use Max to create an editor for my Korg M3. It’s coming along nicely but I have one problem I can’t seem to get around.

I have two menus, one for the waveform (menu1) and another for the osc modulation (menu2). What I want to do is "grey out" the menu2 when any of the last 4 choices are made from menu1 and then re-enable menu2 when any of the first 4 choices are made. The first case is easy. I used a clear method to clear menu2 when I detect a choice higher than 3 from the output of menu1. The hard part is knowing when to re-instantiate menu2 (I am using append).

So what I need to a way to detect:

if menu1 < 4 && menu2.count==0 then append menu2...

I guess I don’t know how to use count properly. It is doing the count AFTER the menu2 is cleared.

Can anyone hep me? I’m hoping i am missing something basic.

Kent


September 20, 2012 | 4:01 am

That brings back memories when I first started with the umenu :-)

To make it as easy as possible here’s what I’d do:

– Pasted Max Patch, click to expand. –

In short… It detects the amount of items in the ‘main’ umenu and then subtracts this with your choice. Resulting in the value becoming -4 or closer to 0 if you’re selecting one of the last 4 items. IMO this is the easiest approach because it prevents you from having to re-calculate your patch every time. And in the event you need more "enable" items you simply change 1 option.

As for the rest; maybe you already had the fading and such worked out but since I was patching anyway decided to check if I could hack this from the back of my mind (which I couldn’t; I always go wrong with the bgcolor stuff at first).

Anyway; hope this can help.

PS: For more ‘slickness’ you could replace the loadbang & trigger object with a mere [loadmess count]. But that’s detail 8-)


September 20, 2012 | 11:02 am

eventually [grab] can be of help in such situations. -110


September 20, 2012 | 2:16 pm

Thank you SO much! This is what I needed. Now I just need to grock it fully. :-)


Viewing 4 posts - 1 through 4 (of 4 total)