Embedding a large MatrixCtrl into a GUI screen to scroll about

radiotonga's icon

Hello dear people,

I'm currently working with very large columns of MatrixCtrl objects with different sizes. I'm using these to control events, but since they have grown so large I'm trying to find a way to reduce the scope of what I'm actually seeing, and to control details with more accuracy. I did some tweaking to store the overall content of these into a Coll object, and then scroll through these lists by a common index and re-feeding this into the Matrixctrl. Now the problem is that since they have unequal sizes (33, 17, 18 for instance) they appear misaligned.

I think that a JS GUI object might do the trick, kind of embedding large Matrixctrl into a window and only showing parts of it depending on a scrollbar. It would be something like this:

oooooooo [ OOO ] oooooooo (Where o = individual matrix cell, and the middle figure is what is actually shown by the GUI window.)

Does anyone here have any pointers or ideas? Perhaps this is already too complicated, but perhaps not. If I could just find a similar object and tweak it that would be the best, since my JS skillz are beyond rusty.

Thank you very much!

Nat's icon

I did something like this a couple years a go, sadly I don't have the code anymore.

I think the best approach is to use a bpatcher and script the position using the offset message.

radiotonga's icon

Thanks for your answer Nat. By scripting the position you mean plain old messages to the bpatcher or something more complex using JS?

BTW, does anyone else have an example code of a similar application? At least now I know my inquiry isn't that peculiar, so hopefully I don't have to re-invent the wheel, especially since I don't know JS.

Nat's icon

You could probably do it just within Max with some sliders and the offset message...

radiotonga's icon

OK, been experimenting with this and it works fine, except that being large UI objects, these matrices take some processing power. I discovered the "hscroll" parameter, which does all the offsetting work for me. Now I would like to know how in the hell do I retrieve these values that the scroll sends back to [bpatcher] (or is it that it sends it to the embedded patch?). While I'm at it, I also can't figure out how to send messages to [bpatcher] without using the inlet, which is actually the inlet of the embedded patch.

Max Patch
Copy patch and select New From Clipboard in Max.
Max Patch
Copy patch and select New From Clipboard in Max.

Here I copy both files, first the patch, then bpatcher:

Nat's icon

I think you pretty much need an inlet to communicate to the bpatcher, but it can be any inlet as long as it goes to a thispatcher object inside the bpatcher...

radiotonga's icon

Thank you! Since there's no apparent way to control the output of "hscroll" then I will just make a custom scrollbar.