Method called when the panel has finished loading

Home Forums General Programming Method called when the panel has finished loading

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #5369
    dasfaker
    Keymaster
      • Topics: 80
      • Replies: 793
      • Total: 873
      • ★★★

      I want to change the values of some modulators at the start of the panel, so I set the values in the method “Called when the panel has finished loading”.

      The problem is that those modulators don’t change it’s value, they have the value they had when the panel was saved. The method is executed, but the modulators don’t receive the new value or they receive this value before they are loaded. If I call the method from the console, values are changed.

      A similar problem occurs with the method “Called before a panel is saved”. I have to save the panel twice to see the value changes of the modulators coded in this method.

      #5370
      atom
      Keymaster
        • Topics: 159
        • Replies: 2945
        • Total: 3104
        • ★★★★★

        Yup i placed the method call before setting the saved program, moved those around the next nightly will have the fix.

        #5373
        dasfaker
        Keymaster
          • Topics: 80
          • Replies: 793
          • Total: 873
          • ★★★

          It’s almost fixed. Now I’m getting those errors:
          Callback error: [GLOBAL_ToneSelect] lua runtime error
          At line [-1]: [C]
          What: C
          Namewhat: method
          Name: getModulatorByName
          Error message: No matching overload found, candidates:
          CtrlrModulator* getModulatorByName(CtrlrPanel const&,String const&).
          Method disabled


          >>> GLOBAL_PanelLoaded()
          ERROR: No matching overload found, candidates:
          CtrlrModulator* getModulatorByIndex(CtrlrPanel&,int)

          #5374
          atom
          Keymaster
            • Topics: 159
            • Replies: 2945
            • Total: 3104
            • ★★★★★

            Well it looks like getModulatorByName and Index are broken, can you show me your code ?

            #5375
            dasfaker
            Keymaster
              • Topics: 80
              • Replies: 793
              • Total: 873
              • ★★★

              Sure

              --
              -- Called when the panel has finished loading
              --
              GLOBAL_PanelLoaded = function()

              panel_loaded = 1

              panel:getModulatorByIndex(1):setValue(0,true)
              panel:getModulatorByIndex(2):setValue(0,true)
              panel:getModulatorByIndex(3):setValue(0,true)
              panel:getModulatorByIndex(4):setValue(0,true)
              panel:getModulatorByIndex(5):setValue(0,true)
              panel:getModulatorByIndex(6):setValue(0,true)
              panel:getModulatorByIndex(45):setValue(0,true)
              panel:getModulatorByIndex(7):setValue(1,true)
              panel:getModulatorByIndex(8):setValue(1,true)
              ani_mod = panel:getModulatorByName("LCD Info Text")
              rect = ani_mod:getComponent():getLuaBounds()
              current_anim_bt = panel:getModulatorByIndex(8)
              panel:getModulatorByIndex(41):setModulatorValue(-1, false, false, false)
              panel:getModulatorByIndex(42):setModulatorValue(-1, false, false, false) panel:getModulatorByIndex(39):getComponent():setPropertyString("uiLabelText"," ") panel:getModulatorByIndex(40):getComponent():setPropertyString("uiLabelText"," ")
              panel:getModulatorByName("BROWSER Patch Name 1"):setModulatorValue(-1, false, false, false)
              panel:getModulatorByName("BROWSER Patch Name 1"):getComponent():setPropertyString("uiComboContent","")
              panel:getModulatorByName("BROWSER Patch Name 2"):setModulatorValue(-1, false, false, false)
              panel:getModulatorByName("BROWSER Patch Name 2"):getComponent():setPropertyString("uiComboContent","")
              end

              #5376
              atom
              Keymaster
                • Topics: 159
                • Replies: 2945
                • Total: 3104
                • ★★★★★
                --
                -- Called when the panel has finished loading
                --
                finishedLoading = function()
                	r  = Random()
                	m1 = panel:getModulatorByName("modulator-1")
                	m2 = panel:getModulatorByName("modulator-2")
                	m3 = panel:getModulatorByName("modulator-3")
                
                	m4 = panel:getModulatorByIndex(3)
                	m5 = panel:getModulatorByIndex(4)
                	m6 = panel:getModulatorByIndex(5)
                
                	m1:setValue (r:nextInt(127), true)
                	m2:setValue (r:nextInt(127), true)
                	m3:setValue (r:nextInt(127), true)
                	m4:setValue (r:nextInt(127), true)
                	m5:setValue (r:nextInt(127), true)
                	m6:setValue (r:nextInt(127), true)
                end
                

                This code works for me and i get random slider positions. I don’t see any errors in your code but maybe there is something else going on.

                #5377
                dasfaker
                Keymaster
                  • Topics: 80
                  • Replies: 793
                  • Total: 873
                  • ★★★

                  I found the problem, it was my fault. I was calling a modulator with a variable previously assigned to a string.

                   

                Viewing 7 posts - 1 through 7 (of 7 total)
                • The forum ‘Programming’ is closed to new topics and replies.
                There is currently 0 users and 138 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