Thanks for submitting this code Tom! I have some hopefully helpful suggestions on how it could be improved.
Panorama X’s blueprint feature is not a very efficient way to get option values. Much simpler and faster is to directly access the options. For example you get get the maximum height of the current form with this simple function:
getformoption("","","MAXIMUMHEIGHT")
(By the way, internally the formblueprint
function is using this exact function to create the blueprint.)
So here is a simplified version of Tom’s fixwindow code:
setwindowoptions "Toolbar",false()
formxy 0,0
zoomwindow
getformoption("","","WINDOWTOPEDGE"),
getformoption("","","WINDOWLEFTEDGE"),
getformoption("","","MAXIMUMHEIGHT"),
getformoption("","","MAXIMUMWIDTH"), "notoolbar noscroll"
I’m not sure if the setwindowoptions statement is needed, since the toolbar is being turned off by the zoom that may be extraneous.
Tom’s closeotherwindows code above won’t work if any of the window names have been changed with the windowname
statement. Here is a version that uses the windowinfo( function so that it will work even if some windows have been renamed, and also works with data sheet and procedures in addition to forms.
// current window is always listed first by info("windows"), so skip it
let otherwindows = arrayrange(info("windows"),2,-1,cr())
looparray otherwindows,cr(),otherwindow
// is this window in the same database as original window?
if windowinfo(otherwindow,"database")=info("databasename")
// figure out what kind of window it is, bring it forward, then close it
let windowtype = windowinfo(otherwindow,"type")
if windowtype = "Form"
openform windowinfo(otherwindow,"form")
elseif windowtype = "Procedure"
openprocedure windowinfo(otherwindow,"procedure")
else
opensheet
endif
closewindow
endif
endloop
This code could still get mixed up if two or more windows have the exact same name. I don’t think there is any way to fix that. Actually, since the window names have to be unique anyway, I think the code can be simplified to this:
let otherwindows = arrayrange(info("windows"),2,-1,cr())
looparray otherwindows,cr(),otherwindow
// is this window in the same database as original window?
if windowinfo(otherwindow,"database")=info("databasename")
// bring window forward, then close it
window otherwindow
closewindow
endif
endloop
CAVEAT: I have not tested any of these programs, or even checked the syntax.