how can i change a subpatch attribute from inside the subpatch?

CowboyTakeTwo's icon

i want to change the background color of a subpatcher, but from inside the patcher, just like i were to send "bgcolor black" message into the left inlet. thanks. just getting into max, so far a gift from god.... be hard to like any other kind of programming now.

CowboyTakeTwo's icon

well that message doesn't change bgcolor anyway. what do i have to send some kinda color code? i tried #666666.

Floating Point's icon

look at the file bgcolor.maxhelp

CowboyTakeTwo's icon

thanks, but i meant the color of the little subpatch object in the main patch.

seejayjames's icon

the actual [p subpatch] object? just use the Inspector. You can also grab and drag any Inspector field onto the object, it'll connect a message box with the right command ready-to-go. Use a [swatch] to make the colors more intuitive, unless you like specifying colors using RGB values :)

CowboyTakeTwo's icon

the subpatch has to be able to trigger it's own color change from within itself. right now, i have an [led] connected to a special output on the subpatch... but i'd like to do away with that garbage and just have the subpatch change color. anybody know if this is possible? thanks.

seejayjames's icon

script sendbox [subpatch scripting name] bgcolor 1. 0. 0. 1.

to [thispatcher]

will set the background color of the subpatch box to red.

you can send any (?) attribute-changing message this way, and hide the messages. the [thispatcher] needs to be on the main level though.

zh's icon
Max Patch
Copy patch and select New From Clipboard in Max.

it's something like this: