Forums > MaxMSP

semi-transparent panel that doesn't pass mouse events to objects below?

February 25, 2010 | 4:42 pm

I am trying to put a semi-transparent colored panel in front of other user interface objects so that those other objects are visible behind the panel, but do not respond to mouse clicks. It seems that using the panel object won’t work, as it passes those mouse clicks to objects behind it. I also don’t want to send "ignore mouse click" messages to all the UI objects behind the panel (there’s tons of them). I took a look at lcd, but couldn’t figure out a way to get it to draw with an alpha of anything other than 1.0. I’d also like to avoid using jit.lcd if possible.

Suggestions?



MIB
February 25, 2010 | 6:19 pm

You can set the "ignore click" function for all your objects at the same time. Just select them all and press command+i. This will open the "multiple objects inspector". Check "ignore click" and voila…


February 25, 2010 | 6:20 pm

I’ve done this using thispatcher scripting. Use a ubutton (which doesn’t ignore clicks!) that’s not connecting anything, it will steal clicks when it’s in front. Bring the transparent panel forward as well for display purposes. When you want it unlocked, send them all to the back. When locked, bring them to the front. Note the scripting names in the inspector.

This method allows you to make UI things that are editable only when given values are set, using if/then statements, or just by having certain user actions also trigger locking/unlocking (IE, you can’t change the number of channels in a recording file while the recording is taking place, but unlocks when stopped)

Here’s an example:

– Pasted Max Patch, click to expand. –

February 25, 2010 | 6:22 pm

lcd works fine. You need to set the bgtransparent attribute.

– Pasted Max Patch, click to expand. –

February 25, 2010 | 8:40 pm

@MIB – thanks, but I neglected to say that I need to hide/show my obsuring panel programmatically within my app, so the thought of setting/unsetting the ignore clicks attribute on all of my underlying UI objects also programmatically is not a fun one.

@MuShoo – Hah! How quickly one forgets the tricks that we used in Max 4 and previous – the invisible ubutton! Thanks…

@Emmanuel – Ah, now I see – thanks! I was under the impression that the transparent attribute only pertained to the *background* of the LCD (since it is named bgtransparent). I didn’t realize that it would work when painting to the *foreground*. I did the same test that your patch shows, but I was using brgb, not frgb. Perhaps a better name is needed for this attribute? Thanks again.


February 26, 2010 | 7:34 am

Don’t worry about ignoreclick, just show/hide the ubutton and the panel programatically with "hidden $1". If they’re on top, the ubutton will steal the clicks as mentioned. Scripting will also work with the bringtofront/sendtoback, but it’s maybe not needed in this case.


February 26, 2010 | 1:46 pm

So both the ubutton and lcd-with-transparency-on methods work fine, thanks. (Still can’t believe I forgot about ubutton!).

But now the next challenge – I’m not sure this is possible, but I’d like to be able to still capture the scripting names of the "covered up" interface objects, while using hover. See patch below – basically, I also want to be able to capture the name of the dial on the right, just like I can the dial on the left….

– Pasted Max Patch, click to expand. –

I think I’m going to have to rethink things as I don’t think this is possible to do – but maybe you guys will show me otherwise!


February 26, 2010 | 5:45 pm

My thinking is this: if you’re using a ubutton, and you have a ubutton paired to every UI object – give the ubutton a scripting name, like "Xdial2." You could then either have some scripting/code to tear off the X proceeding the name, or have any of your code that is looking for ‘Dial2′ also respond to ‘XDial2.’

You’d probably have to regexp, or some weird coll lookup table or something to do that, though.

Though, I’d never used hover before – my mind is now racing with possibilities for it! Thanks for that. :D


February 26, 2010 | 5:46 pm

I suppose another option would be to give all your UI objects a name with a set length (say 5 characters) and then strip anything after that, and name your ubuttons "*****locked"


February 27, 2010 | 1:40 am

Thanks – yeah, those would work, but the pain is that I have zillions of UI objects, and i’d rather not have to hook up all those ubuttons. I may just rethink what I was trying to do in the first place!

Thanks for everyone’s help…


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