HISE Logo Forum
    • Categories
    • Register
    • Login

    [Inconsistency] drawToggleButton obj doesn't contain the id property

    Scheduled Pinned Locked Moved Solved Scripting
    13 Posts 4 Posters 474 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • DanHD
      DanH @aaronventure
      last edited by

      @aaronventure use local laf?

      DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
      https://dhplugins.com/ | https://dcbreaks.com/
      London, UK

      DanHD 1 Reply Last reply Reply Quote 0
      • DanHD
        DanH @DanH
        last edited by

        @DanH or something like

        If (component.(“text” == “myknob1”))
        {
        Laf code
        }

        Not at computer to help further 😅

        DHPlugins / DC Breaks | Artist / Producer / DJ / Developer
        https://dhplugins.com/ | https://dcbreaks.com/
        London, UK

        1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @aaronventure
          last edited by

          @aaronventure Why do you need to?

          Libre Wave - Freedom respecting instruments and effects
          My Patreon - HISE tutorials
          YouTube Channel - Public HISE tutorials

          1 Reply Last reply Reply Quote 0
          • A
            aaronventure
            last edited by

            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 example

            const 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.

            d.healeyD 1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey @aaronventure
              last edited by d.healey

              @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.

              Libre Wave - Freedom respecting instruments and effects
              My Patreon - HISE tutorials
              YouTube Channel - Public HISE tutorials

              A 1 Reply Last reply Reply Quote 1
              • A
                aaronventure @d.healey
                last edited by

                @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.

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by

                  Simple solution - https://github.com/christophhart/HISE/pull/479

                  Libre Wave - Freedom respecting instruments and effects
                  My Patreon - HISE tutorials
                  YouTube Channel - Public HISE tutorials

                  A 1 Reply Last reply Reply Quote 1
                  • A
                    aaronventure @d.healey
                    last edited by

                    @d-healey Nice, let's hope Chris merges it after he comes back next week.

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @aaronventure
                      last edited by

                      @aaronventure If you have your own fork you can pull it in or use my fork, if you need it now.

                      Libre Wave - Freedom respecting instruments and effects
                      My Patreon - HISE tutorials
                      YouTube Channel - Public HISE tutorials

                      A 1 Reply Last reply Reply Quote 0
                      • A
                        aaronventure @d.healey
                        last edited by

                        @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.

                        Christoph HartC 1 Reply Last reply Reply Quote 1
                        • Christoph HartC
                          Christoph Hart @aaronventure
                          last edited by

                          @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.

                          A 1 Reply Last reply Reply Quote 0
                          • A
                            aaronventure @Christoph Hart
                            last edited by

                            @Christoph-Hart ha you know what I meant.

                            thanks 🍻

                            1 Reply Last reply Reply Quote 0
                            • A aaronventure marked this topic as a question on
                            • A aaronventure has marked this topic as solved on
                            • First post
                              Last post

                            29

                            Online

                            1.7k

                            Users

                            11.7k

                            Topics

                            102.0k

                            Posts