Forum

    • Register
    • Login
    • Search
    • Categories

    Add extra data to common components (Button, Slider)

    General Questions
    2
    2
    26
    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.
    • oskarsh
      oskarsh last edited by

      Hey I am working on a project where I am using one base knob and have a couple of variations. For example I have one knob where I want to show a label, others where I want to hide the arc around it. Basically these are all the same Slider Knobs but just with some slight variations.

      Currently what I am doing is to copy the LAF and create a variation like LAF_knobNoLabel or LAF_knobNoArc and assign that to the respected knob. Is there a way that I can assign extra data for a common component like

      {
          arc: false,
          label: true
      }
      

      This would allow for a lot less code duplication in general.

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

        You don't need to duplicate your code. Put the code that the three functions share into a separate inline function and call that from the laf functions. Then you just add the part that's different to the laf functions.

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

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

        4
        Online

        1.1k
        Users

        7.0k
        Topics

        64.6k
        Posts