Using the "matrix" controler from the ControlP5 library

Hi,

Does anyone know how to remove the “moving line” (don’t know how to call it) embeded in the matrix controller from the ControlP5 library ?

By default the matrix is displayed as a (music) sequencer but I’d like to use it for other purposes if possible.

import controlP5.*;

ControlP5 cp5;

int nx = 7;
int ny = 5;

void setup() {
  size(700, 400);

  cp5 = new ControlP5(this);

  cp5.addMatrix("myMatrix")
     .setPosition(50, 100)
     .setSize(200, 100)
     .setGrid(nx, ny)
     .setGap(1, 1)
     //.setInterval(200)
     .setMode(ControlP5.MULTIPLES)
     ;
  
  cp5.getController("myMatrix").getCaptionLabel().alignX(CENTER);
  


}


void draw() {
  background(0);
  fill(255, 100);
  
  
}

Hey,

I am trying to find the piece of code where it draws the line in the controlP5 library source code and I think it’s here :

(C:\Users\username\Documents\Processing\libraries\controlP5\src\controlP5\ on Windows)

theGraphics.rect( cnt * stepX , 0 , 1 , getHeight( ) - gapY );
class MatrixView implements ControllerView< Matrix > {

		public void display( PGraphics theGraphics , Matrix theController ) {
			theGraphics.noStroke( );
			theGraphics.fill( bg );
			theGraphics.rect( 0 , 0 , getWidth( ) , getHeight( ) );

			float gx = gapX / 2;
			float gy = gapY / 2;
			for ( int x = 0 ; x < _myCellX ; x++ ) {
				for ( int y = 0 ; y < _myCellY ; y++ ) {

					theGraphics.fill( _myCells[ x ][ y ] == 1 ? color.getActive( ) : color.getBackground( ) );
					theGraphics.rect( x * stepX + gx , y * stepY + gy , stepX - gapX , stepY - gapY );
				}
			}
			if ( isInside( ) ) {
				//TODO
				int x = (int) ((theGraphics.mouseX - position.x) / stepX);
				int y = (int) ((theGraphics.mouseY - position.y) / stepY);
				if (x >= 0 && x < _myCellX && y >= 0 && y < _myCellY) {
				theGraphics.fill(_myCells[x][y] == 1 ? color.getActive() :
				color.getForeground());
				theGraphics.rect(x * stepX, y * stepY, stepX - gapX, stepY - gapY);
				}
			}
			theGraphics.fill( color.getActive( ) );
			theGraphics.rect( cnt * stepX , 0 , 1 , getHeight( ) - gapY );
			if ( isLabelVisible ) {
				_myCaptionLabel.draw( theGraphics , 0 , 0 , theController );
			}
		}
	}

Thank you @josephh.

I ended up building my own matrix controler and would actually suggest people to avoid using the controlp5 addMatrix method as well because it’s buggy and not well integrated in the library.