HISE Logo Forum
    • Categories
    • Register
    • Login

    How to Store a String in a Preset for popupMenuItems Instead of a Numeric Value?

    Scheduled Pinned Locked Moved General Questions
    10 Posts 3 Posters 233 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.
    • bendursoB
      bendurso
      last edited by

      I want to save the selected item’s string (name) in a preset rather than its numeric index value from a panel’s popup menu. How can I achieve this?

      d.healeyD LindonL 2 Replies Last reply Reply Quote 0
      • d.healeyD
        d.healey @bendurso
        last edited by

        @bendurso What do you want to do with the string?

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

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

          @d-healey I want to store the selected expansion. And I don't know how many expansions have the user installed, so the number value won't work.

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

            @bendurso But won't the preset be within an expansion?

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

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

              @d-healey I want to include samplemaps from other expansions, and is possible :)

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

                @bendurso Perhaps the simplest way would be to use a hidden label with saveInPreset enabled?

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

                1 Reply Last reply Reply Quote 1
                • LindonL
                  Lindon @bendurso
                  last edited by

                  @bendurso said in How to Store a String in a Preset for popupMenuItems Instead of a Numeric Value?:

                  I want to save the selected item’s string (name) in a preset rather than its numeric index value from a panel’s popup menu. How can I achieve this?

                  So.. the way I do this, after a lot of to-ing a fro-ing over the years, and this is because I want to add additional values into my combo box - like a drop down to select FX and the numbering system of combo-boxes wont work - unless I add every new FX at the end of the list - and who wants that?

                  I add a LAF to the combo box - that shows blank for the selected value, but does nice LAFy things with the drop down listing when its showing, and I make sure saveInPreset is disabled

                  In the Call back it populates a label that sits behind the combo box with its text (comboBox.getItemText() .... and calls changed on the text label....

                  The text label is responsible for the action - in my case loading the correct FX into the slot.

                  Here's what it looks like:

                  7d5a365f-77df-44a7-bff7-0908ccb9e2c1-image.png

                  that "CHORUS" in blue - thats a label, that has been tweaked to look like a combo box...there is a combo-box right there - but its default display is set to blank....

                  If this whole thing was just a combo-box and now I want to add (say) a thru zero flanger to my list of modulation effects, right after "FLANGER" - well I could just do that - but now every existing preset the user has would be wrong (off by 1) for all cases where they had loaded an FX that was listed after the FLANGER

                  In essence Im fast coming to the conclusion for long term expandability - fx, filters etc. saving anything in a combo-box value is a bad idea...

                  HISE Development for hire.
                  www.channelrobot.com

                  bendursoB 1 Reply Last reply Reply Quote 2
                  • bendursoB
                    bendurso @Lindon
                    last edited by bendurso

                    @Lindon @d-healey Thanks guys. Yeah, saving it into a combobox or panel looks like a bad idea. Using a label to remember the selection worked for me.

                    I don't know if it makes sense to make a request in Hise to store Strings as an option in comboboxes or panels, in adittion to numbers.

                    LindonL 1 Reply Last reply Reply Quote 0
                    • LindonL
                      Lindon @bendurso
                      last edited by

                      @bendurso said in How to Store a String in a Preset for popupMenuItems Instead of a Numeric Value?:

                      I don't know if it makes sense to make a request in Hise to store Strings as an option in comboboxes or panels, in adittion to numbers.

                      Well its an either or thing - what if the number stored doesnt match the text what should it do then?

                      Plus it would break every existing preset in every HISE product that ever used a combobox...

                      so Im guessing Christophs answer would (rightly) be a big fat no .... its really up to you to do the work if you want it expandable in the long term.

                      HISE Development for hire.
                      www.channelrobot.com

                      bendursoB 1 Reply Last reply Reply Quote 1
                      • bendursoB
                        bendurso @Lindon
                        last edited by bendurso

                        @Lindon I was referring to a toggle option, like "Use strings instead of numeric values." So instead of looking for numbers, it would look for and save string values instead. This would only work when it’s enabled, so it won’t break any existing plugins.
                        But it was just an idea; maybe it doesn’t really make sense.

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

                        21

                        Online

                        1.8k

                        Users

                        12.0k

                        Topics

                        104.0k

                        Posts