buttons and tabs

Home Forums General Programming buttons and tabs

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #54121
    urbanspaceman
    Participant
      • Topics: 7
      • Replies: 38
      • Total: 45

      I have a modulator with two tabs, I have previously made two methods to move from one tab to another with two buttons.
      now I want to use only one method, but I can not make it work.

      my current method is (from the demo)

      viewSwitch = function(mod, value)
      	panel:getModulatorByName("Main"):getComponent():setProperty ("uiTabsCurrentTab", value, false)
      end

      how i have to setup the buttons to work with this method?

      #54122
      urbanspaceman
      Participant
        • Topics: 7
        • Replies: 38
        • Total: 45

        one method and two button

        #54171
        zeoka
        Participant
          • Topics: 73
          • Replies: 466
          • Total: 539
          • ★★★

          with two buttons i see setting radiogroupbutton for them( chose a number) but it will be not perfect , your method could be better with just one button (0,1)
          you have two (0,1) .
          or set up “customModulatorIndex” (search the exact property name ,it is not in head); one 1 and other 0 and do

          local exemple = mod:getProperty(“customModulatorIndex”)
          panel:getModulatorByName(“Main”):getComponent():setProperty (“uiTabsCurrentTab”, exemple, false)

          edit : sometimes we could have issue at startup so if you encounter wrong tab displayed at start up you could directly set the modulatorValue() of the tab in your method.the fact to set it will add the property to the tab

          #54174
          urbanspaceman
          Participant
            • Topics: 7
            • Replies: 38
            • Total: 45

            thanks, I do a test tomorrow
            another question, is possible to pass others value to the method?

            example (i try to xplain)

            in the button properties i want to set a field with the tab name
            so when i click on the button i pass to the method the name of the tab and the value. that way I could have a single reusable method to use with each button on my panel that is used to make a tabs switch

            #54176
            zeoka
            Participant
              • Topics: 73
              • Replies: 466
              • Total: 539
              • ★★★

              the method i writed could work with severals button :
              here the logic :
              btn1 = “customModulatorIndex” set to 0 (in your panel property buttons)
              btn2 = customModulatorIndex” ……..1
              btn3 = customModulatorIndex” ……..2
              then apply the method to all buttons
              when you click on one it will display the corresponding tab

              OR there is a global callback (when any modulator value change) you can use it

              for the tabName you have to get the property as in your method and put it…. where ?
              on the button visibleName ? on other mod ?
              it depends of your panel organization but you can use a componentListBox too (may be practical) instead of buttons

              #54188
              urbanspaceman
              Participant
                • Topics: 7
                • Replies: 38
                • Total: 45

                so I can have a unique method because it can not determine on which tab act?

                #54193
                urbanspaceman
                Participant
                  • Topics: 7
                  • Replies: 38
                  • Total: 45

                  ok, the right code is

                  function viewSwitch(mod, value)
                  	local val = mod:getProperty("modulatorCustomIndex")
                  	panel:getModulatorByName("Main"):getComponent():setProperty ("uiTabsCurrentTab", val, false)
                  end
                  #54194
                  urbanspaceman
                  Participant
                    • Topics: 7
                    • Replies: 38
                    • Total: 45

                    ok i found a workaround
                    in the button properties, set the custom modulator name equal to the tabs name (Main in my case), then with this code

                    function viewSwitch(mod, value)
                    	local val = mod:getProperty("modulatorCustomIndex")
                    	local name = mod:getProperty("modulatorCustomName")
                    	panel:getModulatorByName(name):getComponent():setProperty ("uiTabsCurrentTab", val, false)
                    end

                    you can use only one method for all the tabs!

                    there are contraindications?

                    #54248
                    zeoka
                    Participant
                      • Topics: 73
                      • Replies: 466
                      • Total: 539
                      • ★★★

                      you don’t need tabnames just index to trig the tabs so I don’t understand what you want with tabname

                    Viewing 9 posts - 1 through 9 (of 9 total)
                    • The forum ‘Programming’ is closed to new topics and replies.
                    There is currently 0 users and 111 guests online
                    No users are currently active
                    Forum Statistics
                    Threads: 2,495, Posts: 17,374, Members: 77,605
                    Most users ever online was 12 on January 22, 2019 3:47 pm
                    Ctrlr