controlP5 Slider and Buttons as arrays

Using controlP5,

I need to create 40 sliders and 40 buttons, I use to use Delphi and could create an array of scrollbars with associated buttons. Can I do the same with processing, if so, can anyone could shed some light onto how to go about it.

The slider positions and button captions need to be set both manually and at runtime. The button captions will reflect the scroll bar positions. some other code will also change the slider positions.

So I would in code set the position of a scroll bar something like:
button.caption= scrollbar(X).position

Trying to avoid creating 40 sets of these.

Slider f1 = controlP5.addSlider("SLIDR1")

bt1 = controlP5.addButton("bt1");
bt1.setPosition(SLIDRleftposition, SLIDRheight+SLIDRtopY+2);
bt1.setSize(SLIDRwidth, SLIDRwidth);
bt1.setFont(createFont("SansSerif", 14));
bt1.getCaptionLabel().align(ControlP5.CENTER, ControlP5.CENTER)

There is another recent post by Darthbray that might be worth your while:

Rather than using a library such as controlP5, Darthbray wrote his/her own Button class. An array is made to hold 50 of these, which are created (and added to the array) a little bit later.

Similar to Darthbray’s Button class, you could write your own SliderSet class that groups together a slider and its associated buttons.