error when using pattrstorage to control matrixctrl

Sep 27, 2007 at 5:22pm

error when using pattrstorage to control matrixctrl

Ive written a fairly large patch and have hopes of using pattrstorage to send message to various objects throughout the patch.

I have a matrixctrl (named ‘matrix’ in the example patch below) object that I would like to be able to clear by sending the message [matrix clear] to a pattrstorage object. Unfortunately, I get an error message that matrixctrl needs messages in the format. Obviously matrixctrl can take the ‘clear’ message, so I am assuming there is something wrong/missing with its implementation of the pattr system.

Here is an example:

max v2;
#N vpatcher 100 100 700 500;
#P toggle 215 120 15 0;
#P window setfont “Sans Serif” 9.;
#P message 215 138 74 196617 matrix 0 0 $1;
#P message 26 138 67 196617 matrix clear;
#P newex 109 222 53 196617 autopattr;
#X prestore matrix 96 0 0 0 0 0 1 0 0 2 0 0 3 0 1 0 1 1 1 1 1 2 0 1 3 0 2 0 1 2 1 1 2 2 0 2 3 0 3 0 1 3;
#X prestore matrix 96 40 1 1 3 2 0 3 3 0 4 0 1 4 1 1 4 2 0 4 3 0 5 0 0 5 1 1 5 2 0 5 3 0 6 0 0 6 1 1 6 2;
#X prestore matrix 96 80 0 6 3 0 7 0 0 7 1 0 7 2 0 7 3 0;
#P objectname u469000464;
#P user matrixctrl 27 38 130 66 MatrixDefaultCell.pct MatrixDefaultBkgnd.pct 130 66 16 16 8 4 16 16 1 1 48 2 5120 0;
#P objectname matrix;
#P newex 26 207 67 196617 pattrstorage;
#X client_rect 30 89 670 329;
#X storage_rect 0 0 640 240;
#P objectname u256000463;
#P comment 98 139 100 196617 < -- does not work;
#P comment 290 138 128 196617 works but not what i want;
#P fasten 6 0 2 0 220 180 31 180;
#P connect 5 0 2 0;
#P connect 7 0 6 0;
#P pop;

#33860
Sep 27, 2007 at 7:52pm

On 27 sept. 07, at 19:22, Nick Inhofe wrote:

> Ive written a fairly large patch and have hopes of using
> pattrstorage to send message to various objects throughout the patch.
>
> I have a matrixctrl (named ‘matrix’ in the example patch below)
> object that I would like to be able to clear by sending the message
> [matrix clear] to a pattrstorage object. Unforunately, I get an
> error message that matrixctrl needs messages in the
> format. Obviously matrixctrl can take the ‘clear’ message, so I am
> assuming there is something wrong/missing with its implementation
> of the pattr system.

pattrforward is the way to go. Pattrstorage doesn’t send the message
directly to the object, but via a setvalueof/getvalueof method of the
object which is used to store/recall the internal state of the object.

Best,
ej

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 320 235 68 196617 prepend send;
#P newex 283 207 51 196617 zl ecils 1;
#P newex 283 184 49 196617 zl rot -1;
#P newex 283 267 70 196617 pattrforward;
#P toggle 215 120 15 0;
#P message 215 138 74 196617 matrix 0 0 $1;
#P message 26 138 67 196617 matrix clear;
#P newex 109 222 53 196617 autopattr;
#X prestore matrix 96 0 0 0 1 0 1 0 0 2 0 0 3 0 1 0 0 1 1 0 1 2 0 1 3
0 2 0 0 2 1 0 2 2 0 2 3 0 3 0 1 3;
#X prestore matrix 96 40 1 1 3 2 1 3 3 0 4 0 0 4 1 1 4 2 1 4 3 0 5 0
0 5 1 1 5 2 0 5 3 0 6 0 0 6 1 1 6 2;
#X prestore matrix 96 80 0 6 3 0 7 0 0 7 1 0 7 2 0 7 3 1;
#P objectname u218000002;
#P user matrixctrl 27 38 130 66 MatrixDefaultCell.pct
MatrixDefaultBkgnd.pct 130 66 16 16 8 4 16 16 1 1 48 2 5120 0;
#P objectname matrix;
#P newex 26 207 67 196617 pattrstorage;
#X client_rect 30 89 670 329;
#X storage_rect 0 0 640 240;
#P objectname u867000001;
#P comment 98 139 100 196617 < -- does not work;
#P comment 290 138 128 196617 works but not what i want;
#P fasten 6 0 2 0 220 180 31 180;
#P connect 6 0 9 0;
#P connect 5 0 2 0;
#P connect 5 0 9 0;
#P connect 10 0 8 0;
#P connect 11 0 8 0;
#P connect 10 1 11 0;
#P connect 9 0 10 0;
#P connect 7 0 6 0;
#P window clipboard copycount 12;

#113322
Sep 27, 2007 at 9:14pm

I completely forgot about pattrforward. Thanks!

#113323

You must be logged in to reply to this topic.