Customised sliders not showing properly and not updating bounds

Hello everybody:
I’m having some trouble with a class that groups customised sliders. In the attached picture you can see the app with a grid of 100x100px squares divided in 10x10 little squares. On top of that there are two slider groups of (intended) 100px high and 400px wide that should have been placed at (100, 100) and (100, 200).
First of all, the area of the slider is shown shorter than my requirements (100px of height) if they were well located.
Secondly, this call: sequencers[I]->setBounds(x0, y, seqW, seqH); does not seem to be working in my case, since the whole group should be 400px wide and not 200, as you can observe.
I would like to know what am I missing or doing wrong.
I made a public repository just for you to have a proper access to this work in progress: GitHub - GusCarr/eh00scratch
Thank you very much.

Gus Carr

In SliderGroup::resized() you’re not setting width0, so it keeps its initial value of 200.

Thanks @reuk ! This did the trick (“I should have asked myself about my size”, said the class):

void SliderGroup::resized()
    width0 = getWidth();
    height0 = getHeight();   

However, the sliders height is still shorter than the set value (see pic). I am solving this by modifying the group vertical position and height, but I think I should plunge into the framework code to find out the reasons for this behaviour.
Thanks a lot.


Hello everybody, it seems that I have found the reason for the initial post.
The slider cursor has limits in its travel. These limits are half width from top and bottom of the object area. I wanted to have a slider that would use all the space available, like those found in PureData. When I asked the object about its bounds for colouring the area, it returned me the geometry of the cursor track. The workaround I came up with is simply assigning a shifted position and greater height to the slider:

sliders[I]->setBounds((int) (widthI * I), - 0.5 * widthI, widthI, height0 + widthI);

Also, I had to tweak the SliderLookAndFeel::drawLinearSlider () method a little to avoid the cursor going off the slider.
In the attached screenshot it can be seen a couple of objects with sliderGroups inside. The first slider (there are 64 of them) of the topmost group was dragged to the highest position. Also in the picture is the main part of the tweaking to the SliderLookAndFeel::drawLinearSlider () method.

Thank you all,

Gus Carr

You might find Slider::LookAndFeelMethods::getSliderLayout useful. You can override it in your look and feel to make the slider track fill the entire bounds of the component.

Great, thanks @reuk. I think that it may be impossible to have tutorials of every little thing in the framework. I think I should to spend more time surfing code and docs before posting, he he.
Best regards,

Gus Carr