They were not eliminated in the copy of the files you sent to me, and that is why this is happening.
The way .Initialize works in Panorama X is different than Panorama 6. It cannot be made to work the way it used to, because before Panorama itself was handling all of the low level operations involved in opening a window, and could change that operation any way it wanted. Now, however, Panorama X is using higher level Cocoa API’s, for compatibility with the modern system. In previous versions of Panorama, the .Initialize code would run immediately when the database opened. Now in Panorama X, the .Initialize code runs at a later time, after Apple has finished setting things up. This usually doesn’t matter too much, but it can change the order in which things run.
For example, suppose you have three databases, Alpha, Beta and Gamma. All three have .Initialization procedures, the one for Alpha is
nslog "Start Initializing Alpha"
opendatabase "Beta"
opendatabase "Gamma"
nslog "Finish Initializing Alpha"
The initialization code for Beta is:
nslog "Initializing Beta"
and for Gamma is
nslog "Initializing Gamma"
Now if you quit Panorama, then run it under Terminal.app, and then open the Alpha database, you’ll see the following output in the Terminal window (also the other two databases will open):
2019-06-12 17:37:37.045390-0700 PanoramaX[24859:3077699] Start Initializing Alpha
2019-06-12 17:37:37.459369-0700 PanoramaX[24859:3077699] Finish Initializing Alpha
2019-06-12 17:37:37.547397-0700 PanoramaX[24859:3077699] Initializing Gamma
2019-06-12 17:37:37.637148-0700 PanoramaX[24859:3077699] Initializing Beta
As you can see, ALL of the code in Alpha’s .Initialize routine runs before any code in Beta or Gamma runs. So the code in Alpha’s .Initialize routine is NOT the last word, the other .Initialize routines will run later.
Also notice that Gamma ran first, and Beta after, even though Alpha’s .Initialize code specified them in the opposite order. This is because it is up to Apple’s code to decide which code it will run first. Panorama doesn’t control that.
There are a couple of ways to get around this. One would be to use a timer, like this:
nslog "Start Initializing Alpha"
opendatabase "Beta"
opendatabase "Gamma"
starttimer "Finish_Initialize_Alpha",
"repeat",1,
"next",supernow()+1,
"scope","global",
"code",|||setactivedatabase "Alpha" nslog "Finish Initializing Alpha"|||
Now the finishing code won’t run until 1 second after everything else, after Beta and Gamma are finished opening. Here’s the output in Terminal.app, as you can see, the “finish” code is now running last, as you wanted it too.
2019-06-12 17:49:09.542310-0700 PanoramaX[24859:3077699] Start Initializing Alpha
2019-06-12 17:49:09.906460-0700 PanoramaX[24859:3077699] Initializing Gamma
2019-06-12 17:49:09.997568-0700 PanoramaX[24859:3077699] Initializing Beta
2019-06-12 17:49:10.999836-0700 PanoramaX[24859:3077699] Finish Initializing Alpha
Note that the setactivedatabase
is needed because probably Beta or Gamma will be active when this starts running. (It doesn’t actually matter here since all the code does is output to the log, but I included it since your code will probably need it.)
The other approach would be to open Beta and Gamma secretly, without any windows, and manually open the windows and call the .Initialize code yourself.
nslog "Start Initializing Alpha"
opensecret "Beta"
setactivedatabase "Beta"
opensheet
call ".Initialize"
opensecret "Gamma"
setactivedatabase "Gamma"
opensheet
call ".Initialize"
nslog "Finish Initializing Alpha"
Now everything runs in the exact order specified.
2019-06-12 17:56:23.110704-0700 PanoramaX[24859:3077699] Start Initializing Alpha
2019-06-12 17:56:23.323194-0700 PanoramaX[24859:3077699] Initializing Beta
2019-06-12 17:56:23.557848-0700 PanoramaX[24859:3077699] Initializing Gamma
2019-06-12 17:56:23.557892-0700 PanoramaX[24859:3077699] Finish Initializing Alpha
You don’t have to use opensheet, you could use openform or leave the databases invisible.
As you can see, running Panorama X under Terminal.app and using nslog
statements is a handy technique for seeing exactly what is going on in situations like this. I’ve mentioned this before, but if you have Panorama.app in the Applications folder, you can do this by opening Terminal.app and then typing in
/Applications/PanoramaX.app/Contents/MacOS/PanoramaX
Then Panorama will run normally and any output from nslog statements will show up in the Terminal window.
As a side note for anyone that sends files to me, please include a description of what’s going on in the email itself. It’s frustrating for me to get an email that just says “here’s the file”, then I have to go digging to find the email or thread with all of the previous discussion from days ago (if I even can find it).