Home › Forums › General › Programming › Order of events when loading a panel
- This topic has 7 replies, 3 voices, and was last updated 5 years, 5 months ago by KreditovichNof.
-
AuthorPosts
-
April 16, 2016 at 6:17 pm #69020
Hi,
can someone (will most probably be you Atom 🙂 ) explain the order of events when opening a panel? It would be useful as a confirmation to me but also for beginners.
Or connected question: what events are triggering the OnValueChange methods?
Or other connected question: apparently all modulators positions are saved (how? where?) at panel close and restored at panel open. I think this is causing my problems (I prefer to start clean each time OR in the way I want). Is there a way to prevent this automatic restore of modulator values?My issue:
- I have a PanelLoaded method used for Called when the panel has finished loading. It contains only modulator declarations like
modOsc1Sync = panel:getModulatorByName("Osc1Sync")
and initial settings of variables - I have a central isPanelReady function checking for BootStrapState and ProgramState
- Each OnValueChange methods of modulators has a check for isPanelReady
- Despite of this, the OnValueChange methods are executed when I open my panel and I don’t understand why…
Temporary workaround I’m using: I set a timer at the end of PanelLoaded method and when the timer time elapse I have my correct welcome screen (instead of modulator changes informations).
Thx for your help!
April 17, 2016 at 10:05 pm #69037To prevent automatic restore of modulator events I can provide you a funny solution: when you insert enough modulators into the panel it breaks the “save all values” feature. They will have no value at all (resp. 0). I tried this the hard way on my SuperJX panel. I wanted to keep the vaules and did not know at which point I broke the feature so I reconstructed the panel from scratch – and it happened again at a specific number of modulators. But I did not count them, so I cannot say exactly how much modulators are needed. On the other hand – it did not broke on my Moog Source panel which has a lot of uiLabels but very few sliders. So I guess it needs a certain amount of sliders to break the feature.
Just to say: a uiLabel has a modulator-value too even if it is not used for anything (it is always 0).
- This reply was modified 7 years, 11 months ago by Possemo.
April 17, 2016 at 10:28 pm #69040About your question “where are the vaules saved”: They are simply saved in the panel xml file. When you save a panel (instead of export) you get an xml file which you can look at. Each modulator has its values saved there (if it is not broken):
modulator modulatorCustomIndex=”0″ modulatorCustomIndexGroup=”0″ modulatorIsStatic=”1″ name=”UpperToneName” modulatorVstExported=”0″ modulatorValue=”0″>
…snipwhen it is broken, “modulatorValue=0” is gone.
- This reply was modified 7 years, 11 months ago by Possemo.
April 18, 2016 at 9:59 am #69043Thx Possemo.
I also searched further in the forum and found different topics about “statedata” allowing to save (on panel close) and restore data (on panel open) together with the panel. It is in ctrlr.settings file. Apparently the save/restore of all modulators changes can be disabled using the Preferences.
I will explore this further.Ctrlr is a great tool but the lack of documentation is really a pain and I’m loosing a lot of time due to that. Having a forum is very good but not enough.
We can see that people (me included) are asking things that have been somewhat replied/asked before. The problem is that the answers are not all the time complete and thus this pushes for re-asking the same…
It’s the reason I’m completing my Step by Step guide bit by bit based on all basic things I need/read.April 18, 2016 at 10:44 am #69044Hi again,
well… I didn’t find In Preferences the ability to prevent a restore on panel open…What I also noticed is a difference of behaviour:
- I save the panel, leave it open then close Ctrlr completely. When I restart Ctrlr, the panel opens fine and the last executed instructions are the ones from the timer I’m starting after my “PanelLoaded” method. Good (and I tend to put more and more in that timer to be sure to have exactly the displays I want, probably not the best idea but OK for now)
- I save the panel, close the panel BUT leave Ctrlr open. When I re-open the panel, the display is messy (I have overlapping labels that are set visible/invisible acc. to situations. Here they are all visible) and the last executed instructions are from some OnChange methods, the current tab is absolutely not the one defined in PanelLoaded
So, really confused about the order of events in those different situations but supposed to act in the same way…
April 18, 2016 at 8:46 pm #69054your Step by Step guide is much appreciated. Ctrlr with Lua is very powerful and quite easy to understand if you know all the commands that are needed for a particular task. Well documented panels with a lot of comments in the Lua code would be very helpful as well for beginners.
April 19, 2016 at 6:49 pm #69057Thx for your kind words, Poss!
Yep, I’ll add a lot of Lua stuff into the 2.x version of the guide and in my panel I put a lot of comments as well.
I know what to write, etc… Just a matter of priority and time.
I think I’ll work on it during summer vacations or earlier if my Pro2 panel gets correct enough to be published (I’m now working on initial setup with stateData, Save and on the librarian)October 22, 2018 at 9:25 am #85939 - I have a PanelLoaded method used for Called when the panel has finished loading. It contains only modulator declarations like
-
AuthorPosts
- The forum ‘Programming’ is closed to new topics and replies.