LinearBarVertical #487
-
Any reason why LinearBarVertical wasn't imported into Ctrlr from the JUCE Slider Class, only I could really do with it right now? |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 10 replies
-
I guess for the same reason that there is no twoValueSlider or a threeValueSlider or a rotaryHorizontalVerticalDrag, because they weren't added to Juce when Ctrlr was being developed. (And never added afterward.) I think it's an easy task to implement a linearBarVertical by overriding a rotaryVerticalDrag with LookAndFeel. |
Beta Was this translation helpful? Give feedback.
-
As promised a small demo panel. Basically, you select a "uiSlider" and set it to rotaryVerticalDrag. Then set/ assign a custom LookAndFeel to that modulator. If all the modulators get the same L&F, then apply the L&F to the canvas, but you can set them separately as well. (See init file) If you set the L&F in the init file, it's visible right from the start. But you can also switch l&f with a button (not working in this demo panel, the button has no use at the moment). |
Beta Was this translation helpful? Give feedback.
-
Ok, good on the -ve values. But there is no visual bar, only when you slide to the right (+ve). Keep in mind that the -ve value is actually only a visual presentation, but your synth might only accept values above 0. To handle that, you need modulatorValueExpressions (see modulator section of your slider in the editor pane). And I fixed the bar "filling" to the left for you. Q1: Well.. long story short. I found out a few days ago how to get L&F applied to a uiSlider but I'm still investigating if there's an easier method. Q2. Because the "width" in the L&F function for the slider seems to be a different width than the component actually is. I have to admit that it is quite confusing but if you just take the component width, the bar is the full width of the component. (Also, see the attached panel.) And for your information. I also found out how to get the "horizontalLinearBar" without all the L&F mumbo jumbo. But haven't had time to test it thoroughly. |
Beta Was this translation helpful? Give feedback.
-
I got this code from @Ted-juh, so I don't want to take credit for it, but seeing as I was experimenting with his code I thought I would share it. You can create a vertical bar using this code at startup: Here I have 7 regular uiSlider and 1 uiFixedSlider with names level1 ... level8 The trick is to set value background colour to transparent init = function(--[[ CtrlrInstance --]] type) for i = 1, 8 do local sType = panel:getComponent("level" .. i):getProperty("uiType") if sType == "uiSlider" then panel:getSlider("level" .. i):getOwnedSlider():setSliderStyle(Slider.LinearBarVertical) elseif sType == "uiFixedSlider" then panel:getFixedSlider("level" .. i):getOwnedSlider():setSliderStyle(Slider.LinearBarVertical) end end end |
Beta Was this translation helpful? Give feedback.
I got this code from @Ted-juh, so I don't want to take credit for it, but seeing as I was experimenting with his code I thought I would share it.
You can create a vertical bar using this code at startup: Here I have 7 regular uiSlider and 1 uiFixedSlider with names level1 ... level8
The trick is to set value background colour to transparent
00FFFFFF
or set the alpha to something like22FFFF00
but it overlays theThumb colour colour (see LEVEL 7) , so if it's set to an opaque value e.g.
FFFFFFFF
you won't see the vertical bar.