Making a file secret


#1

In the Panorama 6 incarnation, I had a file that would open another file secretly. There is a button that opens the second file if I need to change or view it. Clicking the close button would save it and make it secret, instead of closing the file. This is not possible in Panorama X. Any ideas for a workaround?


#2

Try this for Panorama X:

setactivedatabase "myOtherDatabase"
makesecret
setactivedatabase ""

#3

The code is not a problem. That comes from the earlier version. I am wondering what I should do to replace the .CloseWindow procedure. I think I need to consider all the implicitly triggered procedure options.


#4

Panorama doesn’t have anything like the .CloseWindow procedure. In MacOS (pre OS X) and Carbon, the application gets all clicks, including clicks in the close box, and can decide what to do with them. In macOS, the operating system handles clicks in default window buttons like the close box. I haven’t figured out how to intercept and override that. So there is no way to repurpose the close button to make it perform a different function.


#5

I was wondering whether there is some way to trigger a procedure that would open the second file automatically if it is closed. What would be the events that could do that? Could it be done just by moving to another record?

It looks like I can save the second file if I modify anything in it, so I can do that before it is closed. But if I should close it, I would like it to open secretly, and wonder how I might trigger that from the first file, possibly before moving to another record.


#6

Bruce, one method you could use to monitor the existence of the secret file and reopen it if it is not present is to use a timer that runs every so often in the background. Here is an example of such a timer:

starttimer "dbMonitor", "code", {
If arraysearch(info("files"),"mySecretDB",1,cr())=0
    opensecret "mySecretDB"
Endif},"interval",60,"scope","database"

This example would be run from the initialize procedure of your primary database and would create the timer that then would check every minute or so to see if the mySecretDB file was open or not. If it was not found it would open it secretly. I show it set to only run when the file that created it is the active file but it could be changed to global if that would be preferable. You can also adjust the interval to any amount of time you think appropriate.


#7

What I think would really work is to check when I move from one record in the first file to another. Closing the second file does not change the lookups in the first file until I move to another record. I have procedural methods of doing that, so I could add the code to those procedures. Or perhaps I could use a .CurrentRecord procedure.


#8

Yes, the .CurrentRecord procedure can be used to reopen the file secretly, followed by a Showpage which will redraw the page, and the lookup info will be there.

I am passing this along, because I can imagine other people needing to use this technique.