Called before a panel is saved

Home Forums General Programming Called before a panel is saved

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

      Hi Atom

      I’m trying to use this method to set some modulators to a desired value each time I save the panel and reopen it, but without luck.

      This is a snippet of the code used

      [code:3og0rwv4]GLOBAL_SaveState = function(saveType, destinationFile)
      a = panel:getModulatorByName("GLOBAL Bank Name")
      a:setValue(0,false)
      end[/code:3og0rwv4]

      The modulator don’t start with the value I set in the code.

      Is this method valid to do that? If yes, how to do it?

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

        Well that should work, i checked that here and it works.
        [code:qwky4sd7]

        — Called when the panel is saved
        — @saveType A number that indicates the type of file beeing saved http://ctrlr.org/api/class_ctrlr_panel.html
        — @destinationFile A file object http://ctrlr.org/api/class_ctrlr_lua_file.html
        — see more http://www.rawmaterialsoftware.com/juce/api/classFile.html

        myMethod = function(saveType, destinationFile)
        console ("panel save")
        panel:getModulatorByName("modulator-2"):setValue(12,true)
        end
        [/code:qwky4sd7]
        the value of my slider is changed to 12 on save.

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

          Yes, it works on save. But when I open again the panel, the modulator doesn’t start with the value assigned in the save method. That is what I want to achieve.

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

            I think i fixed that, a new nightly will be today, give it a try.

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

              Fixed, thanks

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

                Not fixed, after all. I have to save the method to make it work. If I don’t save the method, it’s not executed

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