store bg colour using preset?

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

in this patch i'm trying to store the bg colour using preset. I change bg colour, shift click in preset box 1, but it won't recall. Is it possible to do this, or is there a different method I should be using?

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

It's possible with pattrstorage, but I don't think it is with preset only (you may try to use getattr and memorize the 4 colors values, probably more hassle then pattr&co).

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

Thanks patrick. I've tried to make 2 sliders by duplicating what you did. How do i get the preset buttons to work only with their corresponding sliders (at present both preset buttons change the one slider colour).

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

foobar is the scripting name of the first slider (set thru its inspector), I changed the name of the second slider to foobar2.
Note that you also need to set preset's "pattrstorage" attribute to the name of the pattrstorage (in this case, it's sto) you want to use. This is also done with the inspector.

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

still doing something wrong. Changed the second sto to sto1 and adjusted the presets pattstorgae from inspector, but second preset not working..

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

Two pattrstorages in one patch is not something straightforward ! Are you sure that's what you need?
Here is a quick&dirty patch without pattrstorage that you can easily duplicate, but it's not very nice:

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

I think pattr and related objects are terrific, but they're not super-intuitive to learn (or to set up even when you know them). In this particular case, instead of using attrui (the state of which can't be saved directly by the preset object), how about using swatch (the state of which can be saved directly by the preset object)?

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

maybe what i'm trying to ask in this thread is not the best suited to the problem. What i want to be able to do is highlight sliders if they are selected, so with the 4 sliders/dials in this patch I want to be able to highlight say channels 2 and 4 (by changing bgcolor/ border color etc) if the buttons under them are selected.