Slider TextBox Look and Feel


#1

Hi,

I don’t see a look and feel method to edit the actual shape of slider textboxes. I want to round the corners of them. Any suggestions?

Thanks…


#2

It’s a Label member, you need to override LookAndFeel::drawLabel(…).


#3

Ah, thanks Dave.


#4

Ok I’m able to change the l+f of labels. But how do I change just the slider labels without affecting the others…can I use something like

if (label is attached to Slider)…then bla bla bla…

Thanks!


#5

Just apply your custom look and feel to your sliders only e.g.

slider.setLookAndFeel (&sliderLookAndFeel);


#6

I’ll try that Dave. Although I have all of my custom Look and Feel stuff in one class so I was hoping to just put an if statement in the Label l+f. I suppose I can create a separate one for sliders. Thanks…


#7

I haven’t really looked into it but I suppose you might be able to use Component::findParentComponentOfClass in the drawLabel method and see if that returns a valid pointer?


#8

Got it to work with the following…

Component* comp = label.getParentComponent();
if (dynamic_cast<Slider*>(comp)) //if it is a slider
{
//do whatever her

}

Thanks


#9

Shouldn’t that be

?


#10

juce wiki…