[Inconsistency] drawToggleButton obj doesn't contain the id property
-
@aaronventure Why do you need to?
-
I am.
const var settingsButton = Content.createLocalLookAndFeel(); settingsButton.registerFunction("drawToggleButton", function(g, obj) {
The llaf object is then assigned to a control. The obj parameter in
drawRotarySlider
has an id property so I can write graphics like they know what control they're drawing.@d-healey
I declare my controls using a parameter object where I define all kinds of things that aren't in the default component properties list. Here's an exampleconst var vol = Control.createSliderNative( { "id": "Vol", "fullName": "Vol", "min": -100, "midPoint": -12, "max": 0, "defaultValue": -12, "stepSize": 0.01, "xCenter": UI.WIDTH/2, "y": UI.SETTINGS_FIRST_Y + counter * (UI.SETTINGS_CONTROL_SPACING + UI.SETTINGS_CONTROL_HEIGHT), "width": UI.SETTINGS_CONTROL_WIDTH, "height": UI.SETTINGS_CONTROL_HEIGHT, "prefix": "", "suffix": " dB", "offText": "-Inf.", "displayDecimals": 1, "fontSize": UI.FONT_SIZE_CONTROLS, "fontType": UI.FONT_TYPE_CONTROLS, "enableAutomation": true, "lookAndFeelObject": LookAndFeel.settingsSlider, "mouseAnimator": [0.2, 30], "clickAnimator": false, "passiveAnimator": false, "parentComponent": false, "enableMidiLearn": false, });
I use displayDecimals to determine how many decimals are displayed in the value, as well as how many are displayed when a user attempts value edit by double clicking. Prefix and offText are self explanatory. I can use xCenter instead of x to position a control that way. Enable automation sets up multiple things in the back.
This entire object is stored in ControlProperties[id] so that they can be accessed from anywhere. I can only access them if I know the ID.
The animators each create a timer with counters and make the alpha accessible using a function getMouseAlpha(component). As these are stored in separate objects in the Animation namespace and are component-specific, I need the ID to access them.
It all works great using the obj.id property for the slider.
Before you say I can just use the panel, I would love to, but its daw automation is not implemented completely and the mess my workaround makes in the component list is annoying, so I'm looking for alternatives.
-
@aaronventure said in [Inconsistency] drawToggleButton obj doesn't contain the id property:
I declare my controls using a parameter object where I define all kinds of things that aren't in the default component properties list
I was doing this kind of thing in a project. My trick was to write it in the component's text property as a json string, then I could parse that in the laf.
-
@d-healey said in [Inconsistency] drawToggleButton obj doesn't contain the id property:
component's text property
yeah that's a workaround, then just refer to the property that I passed for full name.
-
Simple solution - https://github.com/christophhart/HISE/pull/479
-
@d-healey Nice, let's hope Chris merges it after he comes back next week.
-
@aaronventure If you have your own fork you can pull it in or use my fork, if you need it now.
-
@d-healey haha i'm not that deep in yet, my HISE modifications are limited to one macro and a few preprocessors in projucer, which I just stash and reapply on every pull.
but I'll do the same modification, it really is just a single line.
-
@aaronventure I can merge pull requests from anywhere in the world. The power of the internet.
It's just the doc generator that I have setup a local script on my studio system with SSH access etc. that I was too lazy to setup on my Macbook.
-
@Christoph-Hart ha you know what I meant.
thanks