Should info("windows") include secret windows?


#1

I’m sure that, in the past, message info("windows") included secretly opened databases but maybe not because now it doesn’t. This code:

closedatabase "Miscellaneous categories"
if error
    nop
endif
opensecret "Miscellaneous categories"
message info("windows") 

does not include Miscellaneous categories:Secret in its output. Should it? If not, how do I ascertain whether a database is secretly open?


#2

info(“files”) includes the information you are looking for.

dbcheckopen(“Name_of_Database”) will also work.


#3

No, info("windows") works exactly the same as it has worked for the past 30 years, visible windows are listed.

I was going to mention info("files"), to be honest I have absolutely no recollection of the dbcheckopen( function’s existence! Apparently it’s been around for at least ten years and I converted it from version 6 to X, but I don’t remember any of that :thinking:


Michael, I don’t remember when you started using Panorama. In early versions of Panorama there was no way to make a database the current database without bringing one of that databases window to the front. To get around that, I would create a form named “SECRET”, and save the database with that form open, but far to the right so that it couldn’t actually be seen. So in those days, the code

window "database:SECRET"

would only work if the database had an actual form named SECRET, and that form was already open, hopefully in a “secret” position off the edge of monitor where it couldn’t be seen.

This was a handy technique, but not that handy because you had to create the form and make sure it stayed open all the time, and in a position where it couldn’t be seen. So starting in Panorama 3 I added a hack to the window statement so that it would pretend there was such a form even if it didn’t exist. This was much nicer – you could temporarily make a different database active without the database user noticing any difference to the visible window arrangement, and you didn’t have to bother to set up a special form in a special position.

This hack was done by adding an internal variable to Panorama that was normally empty but could have the name of a database in it. When it contained a database name, Panorama would pretend that the current window was a form named SECRET, even though there was no such window.

So as you see, a secret window is just make believe. There is no window, Panorama just pretends there is one for a short while. When you switch to a different window, or the code finishes, the internal variable is cleared, the make believe ends, and Panorama goes back to it’s normal mode where the current database where actions will be performed is always the one associated with the topmost window.

When I created Panorama X, I thought “hey, these pretend windows are kind of silly”. So I added the setactivedatabase statement. This actually uses the same internal variable I just described, so Panorama is still pretending there is a window that isn’t there, but it’s no longer called a “secret window” because that causes people confusion, as evidenced by your question. However, the window statement still contains the hack of looking for the special form name “secret”, so that old code will work.

So, the info("windows") function doesn’t list any secret windows because there actually is no such thing as a secret window, they are pure fiction.

If anyone is reading this as a fairly new Panorama user and has never heard of secret windows, my recommendation would be to forget that you ever read any of this. Just use the setactivedatabase statement. That’s what I do.


One more minor note about your (Michael’s) specific code example – even if the info("windows") function DID list the fictional secret window (there could never be more than one, the one we are temporarily pretending to exist), it wouldn’t be listed in the example you posted. At the time the message statement is run in your code, the current database is the whatever database is associated with the topmost visible window. The opensecret statement does NOT create a fictional secret window, it load the specified database into memory but does not make it active. So even if the fictional secret window was listed by the info("windows") statement, there isn’t one to list anywhere in your program.

If you want to make this newly loaded database active so that you can perform actions on it you must either use

setactivedatabase "Miscellaneous categories"`

or

window "Miscellaneous categories:SECRET"

immediately after the opensecret statement.


#4

It was 1987 or 1988, using Panorama 1. I recall needing assistance one afternoon Eastern Australian time so, in desperation, I rang ProVUE. You answered and solved my problem. Here we are almost 30 years later and you’re still doing it. Thanks for the tutorial - most helpful as always.