Test if Window is open.
On firing a script that opens a new window how would I check to see if the window is already open (perhaps lost behind the main window) and if it is go to it and bring it forward?
WindowNames will return a list of the names of all currently open windows. If you want to see if a window named "High Score" is already open, this test will work:
If [ Not IsEmpty ( FilterValues ( WindowNames ; "High Score" ) ) /* Window is already open */]
There are also scripting tricks that can prevent a user from losing a window back behind other windows that can be implemented by simulating "modal" window behavior. (User is prevented from interacting with other FileMaker windows until they close the current "modal" window.)
Thanks Phil. You are a great help as always :)
I'm doing a find layout in a new window. How would I set the global to fire the find script when the user hits enter.
OnObjectKeystroke can be used to fire a script. The script can use Get ( TriggerKeystroke ) to check to see if the key pressed was the enter key. (Char ( 10 ) is the enter key )
Perfect. Thanks once again Phil :)
this is my first post, but I got an elegant solution to this matter. Check out the attached picture for my real time script, works great!
I basically try to select the window, if it is not open it reports an error, which triggers opening a new window using an if script step!
If you call a window and it's not there, it returns error 112
After the "select window", test the for that error.
If Get(LastError) = 112
then you know it's not there and you can create a new one.
Select Window [Name: "MyWindow"; Current File]
If [Get (LastError) = 112
Set Window Title [Current Window; New Title: "MyWindow"]
This selects the window, if it exists. If not, it changes the title of the Current Window to be the one you want and uses that window. (That way you don't have to close it. -- Reduce, Reuse, Recycle!)
Retrieving data ...