I would like to open files in order

Hello Friends,
I double click on the file I want to open. Within that file under the “Initialize” procedure I created a statement to open a vendor file. The problem is that the vendor file is the frontmost file and I don’t want that. It should be in back of the main file. I did not have this problem in Pan 6.
I would appreciate any help.

Anytime you open a file, it becomes the frontmost file. This has always been the case. Your .Initialize command could add a Window command, after the OpenFile, which would bring the main file to the front again.

Local thisWindow thisWindow = info("WindowName") OpenFile "Vendor File" Window thisWindow

I have a feeling there might be a bug hidden here. Running Dave’s code as well as variations using a second openfile to open the original file after the vendor file is opened all end up with the vendor file as the top window. Once or twice I was able to get the original file to end up on top but it would not when run again.

Ok, I just noticed that the second file I was testing with had an .Initialize procedure that was forcing it to the front after the first procedure finished. So scratch the above.:confused:

That sounds like a bug of a different color. In Panorama 6, if the .Initialize of one file opened another, which also had a .Initialize, the second file’s procedure would run like a subroutine of the first. It would run, and when it finished, the first .Initialize would resume with the first statement after the OpenFile.

Well, I knew something bit me. Just didn’t know what bug it was.

Thanks for pointing that out and testing it. I followed Dave’s procedure and ended up with the same thing. Any other ideas would be appreciated.

If it is the same problem I stumbled across you probably have something in the .Initialize file of the vendor database that is bring it forward at the wrong time. In my experiment I had something that was trying to open a form that did not exist and should not itself have brought that window to the front but it did. Once I commented that line out it then worked properly.

Interesting. After some experimenting I discovered something. I did have an “,Initialize” procedure in the Vendor file which contained ";Global Sel;SuperObject “TextList”,“GetList”.
After i commented out the "SuperObject “TextList”,“GetList” then the Vendor Database went to the back like it should have.

The code you were using:

superobject "TextList","GetList"

is invalid – there is a missing parameter. So this code never worked.

It seems like in Panorama 6 it was probably just failing silently, when there should have been an error.

Panorama X is also not handling this properly – it is apparently just silently stopping the procedure. I’ve added this to the bug tracker.

Since in your case the code apparently wasn’t needed, you should probably just take it out to solve your immediate problem.

It’s not just SuperObjects - I’ve encountered a few cases where a run-time error did not generate an error message, but just stopped the procedure in its tracks without any notification. Sadly, I can’t remember what commands they were although I did report one or two to the forum.

I reported this same problem a while ago as well, and it is still a problem - the .Initialize procedures for files that are opened by another (within its own .Initialize) used to run like a subroutine, i.e., run completely then pass control back to the calling file in Pan 6. In Pan X the .Initialize code doesn’t run until the calling file’s own .Initialize is finished and it messes up the intended layering of windows.

Ah, I see that this is BitBucket issue #626 which was filed in December and has not been visited since. Is there a plan to correct this?