Calling all "start callbacks" just after compiling?


When loading a gig file, all rackspaces are loaded one after the others and the different scripts are also started. Each time a script is started, the Initialization section is executed, then every widget callbacks are called for initialization and finally the On Activate callback is called too. This means that in a normal use situation, a script never runs without having the widgets and On Activate callbacks called at least once.

However, it seems there is an exception, which is when compiling. Indeed, after a compilation, only the Initialization section is started, and the script runs in a configuration that never happens in a normal use situation. So, to test a script in a context reflecting a normal use situation, it is necessary to add an additionnal rackspace, to switch to it and to switch back to the rackspace containing the script. Then the different callbacks are called and the test can be achieved properly.

It could perhaps be nice to start the different callbacks after compiling to put the script in a standard running configuration? :thinking:



It might make sense to make the rackspace inactive and then immediate active again, immediately after manual compilation, to replicate this but I’m not sure it’s worth the trouble. I don’t think widget callbacks would get called either as they won’t have changed, that’s purely something that can happen the very first time the rackspace is loaded.

In particular, the reason that On Activate runs during rackspace loading is because each rackspace is temporarily activated immediately after loading is to work around some issues with plugins that do their own initialization at the wrong time. That Activation call might go away at some point.

It’s easy enough to switch to another rackspace and back so this is low priority



I noticed widget callbacks are called even if no value changed each time a rackspace is activated again, not only the very first time.

For me, it can be low priority. From now, I will systematically add an empty rackspace to switch to and back. And I will put a note in my copy of the GP Script manual to remember this. But I am also thinking to other GP script programmers…