Home › Forums › General › Programming › Method called when the panel has finished loading
- This topic has 6 replies, 2 voices, and was last updated 11 years, 3 months ago by dasfaker.
-
AuthorPosts
-
January 2, 2013 at 9:41 pm #5369
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.
January 2, 2013 at 10:26 pm #5370Yup i placed the method call before setting the saved program, moved those around the next nightly will have the fix.
January 3, 2013 at 6:54 pm #5373It’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)January 3, 2013 at 7:06 pm #5374Well it looks like getModulatorByName and Index are broken, can you show me your code ?
January 3, 2013 at 7:17 pm #5375Sure
--
-- 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","")
endJanuary 3, 2013 at 9:23 pm #5376-- -- 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.
January 3, 2013 at 10:23 pm #5377I found the problem, it was my fault. I was calling a modulator with a variable previously assigned to a string.
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.