HISE Logo Forum
    • Categories
    • Register
    • Login

    Syntax for Setting and Getting Array Data From a Panel

    Scheduled Pinned Locked Moved Scripting
    26 Posts 5 Posters 987 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.
    • ulrikU
      ulrik @d.healey
      last edited by

      @d-healey said in Syntax for Setting and Getting Array Data From a Panel:

      @aaronventure said in Syntax for Setting and Getting Array Data From a Panel:

      I have a panel that I want to use to create a horizontal range slider.

      Why not use the built in range slider?

      Is it not broken?

      Hise Develop branch
      MacOs 15.3.1, Xcode 16.2
      http://musikboden.se

      Christoph HartC d.healeyD 2 Replies Last reply Reply Quote 0
      • Christoph HartC
        Christoph Hart @ulrik
        last edited by

        What's the syntax for storing an array in a panel with .setValue(), and for getting it?

        setValue([0.5, 0.8]);
        min = getValue()[0]; // case that panel is not initialised needs to be handled too though...
        
        A 1 Reply Last reply Reply Quote 1
        • d.healeyD
          d.healey @ulrik
          last edited by d.healey

          @ulrik said in Syntax for Setting and Getting Array Data From a Panel:

          Is it not broken?

          I never used it. But I just tried it and seems to be broken. I suggest we nag Christoph to fix it instead of hacking a panel (unless you need the panel method for some particular reason). :)

          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 The default controls don't let me define custom modifier behavior (ctrl, alt, shift), don't have the useful .data functionality and don't have the mouse callback.

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

              @aaronventure said in Syntax for Setting and Getting Array Data From a Panel:

              define custom modifier behavior (ctrl, alt, shift), don't have the useful .data functionality and don't have the mouse callback.

              Broadcaster would solve those issues I think (well not the data one).

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

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

                @d-healey True, but I still can't disable built-in modifier behavior.

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

                  @Christoph-Hart Thanks.

                  Is there a way to set only one element, or do I have to be defining all elements every time I'm setting the value?

                  Is this done by setting these value somewhere else, like a local var which is an array

                  local tempVal = [];
                  

                  and then passing the array itself every time I setValue

                  setValue(tempVal);
                  

                  ?

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

                    local v = this.getValue();
                    v[1] = "New Value";
                    
                    // technically this is not required because the value is already == v
                    this.setValue(v); 
                    
                    // this will fire the notification that the value has changed.
                    this.changed();
                    A 1 Reply Last reply Reply Quote 2
                    • A
                      aaronventure @Christoph Hart
                      last edited by

                      @Christoph-Hart

                      Got it working. Thanks.

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

                        @aaronventure FYI, I've added the ability to reassign modifier / mouse click types to different events.

                        Docs:

                        Link Preview Image
                        hise_documentation/scripting/scripting-api/scriptslider/createmodifiers.md at master · christophhart/hise_documentation

                        The markdown files for the online documentation. Contribute to christophhart/hise_documentation development by creating an account on GitHub.

                        favicon

                        GitHub (github.com)

                        Link Preview Image
                        hise_documentation/scripting/scripting-api/scriptslider/setmodifiers.md at master · christophhart/hise_documentation

                        The markdown files for the online documentation. Contribute to christophhart/hise_documentation development by creating an account on GitHub.

                        favicon

                        GitHub (github.com)

                        Dan KorneffD A 2 Replies Last reply Reply Quote 4
                        • Dan KorneffD
                          Dan Korneff @Christoph Hart
                          last edited by

                          @Christoph-Hart thanks! I was just about to request this :)

                          Dan Korneff - Producer / Mixer / Audio Nerd

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

                            @Christoph-Hart Nice! A few questions:

                            1. This is just for re-assigning default modifiers, right? Or will mods.shiftDown return 1 if shift is down, therefore letting me do whatever?

                            2. Is the CTRL modifier the same for Windows and Mac, or is the Ctrl on windows firing the CMD modifier?

                            3. Given how we're creating an object here and there's no .data for a slider, what's the best way to approach encapsulation? I can set everything up within a single function, sure, but if the in-function reference is a local variable, I can't access it from e.g. the control callback in case I have one control that needs to do something else other than what I set up.

                            In my case, I'm using the panel, and have a sizeable function that handles everything: I have a few timers for various types and parts of an animation that happens on user action, and these timers are stored into widget.data.someTimer, so I can access them from anywhere. Moving to a slider would require figuring out how to keep the same functionality of the timers, while keeping the workflow the same (set up one type of control with a single function, passing relevant parameters).

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

                              @aaronventure said in Syntax for Setting and Getting Array Data From a Panel:

                              This is just for re-assigning default modifiers, right? Or will mods.shiftDown return 1 if shift is down, therefore letting me do whatever?

                              Yes, you can reassign "reset to default", "enable fine mode", "show MIDI learn" and "show text label" to any combination of modifier keys / mouse clicks. If you want to add custom behaviour, use a broadcaster.

                              Is the CTRL modifier the same for Windows and Mac, or is the Ctrl on windows firing the CMD modifier?

                              I'm fairly confident that command key flag will also be set by the ctrl control on Windows, but I'm not on Windows right now so I can't confirm it.

                              Given how we're creating an object here and there's no .data for a slider, what's the best way to approach encapsulation?

                              Not sure, need more info, but pretty much anything can be done now with broadcaster and modifier keys reassignment and making it scalable / encapsulated is just a question of finding the right data layout for your use case.

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

                                @d-healey said in Syntax for Setting and Getting Array Data From a Panel:

                                well not the data one)

                                Coming back to say that this was overall easier than I thought.

                                inline function helper(param)
                                {
                                                local widget = {};
                                		widget.ref = Content.addKnob(param.id, param.x, param.y);
                                		widget.data = {}; // set up the data object
                                
                                               return widget;
                                }
                                

                                There's a bug with setModifiers(mods.ResetToDefault, mods.disabled) not disabling Alt+Click reset so waiting on that to continue migration from the panel widget to sliders.

                                1 Reply Last reply Reply Quote 0
                                • First post
                                  Last post

                                17

                                Online

                                1.8k

                                Users

                                12.0k

                                Topics

                                104.4k

                                Posts