HISE Logo Forum
    • Categories
    • Register
    • Login

    Beginner Questions - Create Custom Callback

    Scheduled Pinned Locked Moved General Questions
    7 Posts 3 Posters 190 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.
    • T
      tomekbruml
      last edited by

      Hi there, I am very new to both scripting and HISE.
      I have been working my way through the documentation and have been following along with the PhaseWizard tutorial project.
      Ive been getting along fine so far and really enjoying it.

      However I did get stuck for a long time on the section creating custom callbacks for the combo box's

      When I right clicked on the combobox, pasted into [onInit] and filled in the custom logic as follows:
      WaveformGenerator.setAttribute(WaveformGenerator.WaveForm1, value);

      I got an error message in the console.

      the callback pasted the following:

      inline function onOSC1 WaveControl(component, value)
      {
      //Add your custom logic here...
      };

      Content.getComponent("OSC1 Wave").setControlCallback(onOSC1 WaveControl);

      I eventually found that the issue was the space between onOSC1 and WaveControl(component, value). Was this an error on my part or an issue with the way I copied the callback func to my clipboard or something else?

      Thanks, Tom

      ustkU 1 Reply Last reply Reply Quote 0
      • ustkU
        ustk @tomekbruml
        last edited by ustk

        @tomekbruml Though the name string of the component can have spaces, the function's name cannot contain any space, no more than for a variable name for instance.

        Can't help pressing F5 in the forum...

        T 1 Reply Last reply Reply Quote 0
        • T
          tomekbruml @ustk
          last edited by

          @ustk Thankyou! I am surprised then that a space is included when creating custom callback from selection.

          Matt_SFM 1 Reply Last reply Reply Quote 0
          • Matt_SFM
            Matt_SF @tomekbruml
            last edited by

            @tomekbruml Indeed, that's weird. HISE doesn't complain if you give a component an id using spaces...
            And it outputs the CB accordingly:

            inline function on Knob 1 with SpaceControl(component, value)
            {
            	//Add your custom logic here...
            };
            
            Content.getComponent(" Knob 1 with Space").setControlCallback(on Knob 1 with SpaceControl);
            

            But you must never use spaces when defining your component's ids.

            Develop branch
            Win10 & VS17 / Ventura & Xcode 14. 3

            ustkU 1 Reply Last reply Reply Quote 0
            • ustkU
              ustk @Matt_SF
              last edited by ustk

              @Matt_SF Mmm... ere you presented it with spaces, which shouldn't be the case, or was it intentional?

              @tomekbruml I have never encountered this issue, here's what you should get from right click "Create custom callback from selection"

              inline function onKnob1Control(component, value)
              {
              	//Add your custom logic here...
              };
              
              Content.getComponent("Knob1").setControlCallback(onKnob1Control);
              

              Are you using the develop branch?
              What operating system?

              Can't help pressing F5 in the forum...

              Matt_SFM 1 Reply Last reply Reply Quote 0
              • Matt_SFM
                Matt_SF @ustk
                last edited by Matt_SF

                @ustk yes I intentionally gave the knob an id with spaces to see how HISE would react, and it doesn't complain at all. Creating a CB using the right click menu ends up to be what I posted.
                HISE should tell the user not to use spaces in the component's id.

                Edit: damn auto correct

                Develop branch
                Win10 & VS17 / Ventura & Xcode 14. 3

                ustkU 1 Reply Last reply Reply Quote 0
                • ustkU
                  ustk @Matt_SF
                  last edited by ustk

                  @Matt_SF Oh I see! My bad! I just couldn't think you could name a component with spaces, this is so unnatural, I wasn't able to follow here :beaming_face_with_smiling_eyes:

                  Can't help pressing F5 in the forum...

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

                  18

                  Online

                  1.7k

                  Users

                  11.9k

                  Topics

                  103.3k

                  Posts