Forums > Javascript

Using the patcher method to set Presentation_rect of slider, size stays default?

February 22, 2011 | 4:14 pm

Hello all,
I’ve written a script that dynamically creates sliders / dials and other interfaces as needed. Now to make them all fit right in the location I’ve given them standard sizes (20 / 40) so they fit together.
The line is as follows:

a = patcher.newdefault(104, 25, "slider", "@presentation", 1, "@hint", name, "@presentation_rect", interfaceCount, interfaceCount2, 20, 40, "@min", min, "@size", tempmax, "@floatoutput", 1);

Now, this used to work fine, until I moved all functions to a seperate file and made the functions global with the max Global object. Everything else (Dials, numbers, floats, checkboxes) work perfectly, and even allow me to set their size (The two last variables of presentation_rect), EXCEPT the slider. The slider only allows the position to be set, but it’s size stays default no matter what. Not even a size of 100, 50 seems to do anything at all. I even tried changing it to a message like this:

a.message("presentation_rect", 10, 10, 20, 40);

Which will move the slider to the 10, 10 position, but it’s size is not changed to 20 x 40. What am I doing wrong?


February 22, 2011 | 4:44 pm

Strangely I’ve noticed that if I put a.message("presentation_rect", 10, 10, 20, 40); in a bang() function and call bang it manually, it WILL work. Just not from the function, nor if I call the bang automatically from within the script. Bug?


March 7, 2011 | 3:08 pm

Could you post an example? Feel free to just use this.patcher.message() and pass the message that you would use with the thispatcher object.


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