Hi
I´ve written the code in Matalab and then compile in C++ for Juce framework. This is a very simple code but reproduce the graphical issue I´m experiencing. I´ve just kept relevant lines (if not let me know).
I need to display the value of the knob when mouse hover or drag its position, but slider. setPopupDisplayEnabled (true,true,this) doesn´t work here as it is. Surely I´m wrongly referencing the component(or even placing wrong), but as my C++skills are really low, that´s why I´m here.
As it is written, it display de name of the knob and I know how to trun off this notification, but I don´t knwo how to replace for the value.
This graphical topic is the last thing to complete my project, I´d really appreciated if someone can help me in solving this out.
Thanks
Pablo
class ParamWidget
{
public:
ParamWidget(AudioProcessorEditor& parent,
AudioProcessorValueTreeState& vts,
const String& parameterID,
Rectangle displayNameBounds,
const String& displayNameJustification)
{
parent.addAndMakeVisible(displayName);
displayName.setBounds(displayNameBounds);if (displayNameJustification == "above") displayName.setJustificationType(Justification::centredTop); else if (displayNameJustification == "below") displayName.setJustificationType(Justification::centredBottom); else if (displayNameJustification == "left") displayName.setJustificationType(Justification::centredLeft); else if (displayNameJustification == "right") displayName.setJustificationType(Justification::centredRight); displayName.setText(vts.getParameter(parameterID)->name, dontSendNotification); displayName.setColour(Label::textColourId, getForegroundColor()); } virtual ~ParamWidget() {}
protected:
Label displayName;
};class SliderKnob : public ParamWidget
{
public:
SliderKnob(AudioProcessorEditor& parent,
AudioProcessorValueTreeState& vts,
const String& parameterID,
const String& displayNameJustification,
const String& style,
const String& editBoxPosition,
bool doLog,
Rectangle displayNameBounds,
Rectangle controlBounds,
LookAndFeel* filmstrip)
: ParamWidget(parent, vts, parameterID, displayNameBounds, displayNameJustification),
attachment(vts, parameterID, slider)
{
int textBoxWidth = 75;
parent.addAndMakeVisible(slider);
slider.doLog = doLog;
slider.setBounds(controlBounds);
slider.setTooltip(displayName.getText());
if (style == “hslider”)
slider.setSliderStyle(Slider::LinearHorizontal);
else if (style == “vslider”)
slider.setSliderStyle(Slider::LinearVertical);
else
slider.setSliderStyle(Slider::RotaryHorizontalVerticalDrag);Slider::TextEntryBoxPosition textBoxPosition = Slider::NoTextBox; if (editBoxPosition == "editleft") textBoxPosition = Slider::TextBoxLeft; else if (editBoxPosition == "editright") textBoxPosition = Slider::TextBoxRight; else if (editBoxPosition == "editabove") textBoxPosition = Slider::TextBoxAbove; else if (editBoxPosition == "editbelow") textBoxPosition = Slider::TextBoxBelow; slider.setTextBoxStyle(textBoxPosition, false, textBoxWidth, 20); slider.setColour(Slider::textBoxTextColourId, getForegroundColor()); slider.setTextValueSuffix(" " + vts.getParameter(parameterID)->label); slider.setPopupDisplayEnabled(true, true, this); ); slider.setLookAndFeel(filmstrip); } BetterSlider slider; SliderAttachment attachment;
};