Use an OnExitObject script with
Exit Script [ result: False // no quotes ]
(and you probably should put some condition in to let the user actually exit the field at some point …)
You're a genius, I'd never have figured this out !
Worked perfectly !
Thanks a million !
If you are using FileMaker 12/13, then you can open a new window, with it set to Dialog Window - Modal (under: Specify Advanced Style).
Now your users can’t click on the background …
Best wishes - Alan Stirling - London UK
Not sure, I've set such a dialog but I can click the background if field is selected, and it deselects it (in that case I didn't put an OnObjectExit thought)
You could also use Halt script (during exit field trigger)
Ok, that's awesome, but now I've a problem.
You can't quit Filemaker anymore.
Even with one button that launches a quit script.
So, how to make a quit button that work, since the exit script triggers first, before launching
What you should do is the following:
You need 2 scripts:
First script is the trigger on exiting the field:
If [IsEmpty ( $$Exit)]
Second script: script to run when clicking on a buton
Set Variable [$$Exit; Value:1]
Close File [CurrentFile]
This should do the trick (when closing the file by clicking on this buton, this will eliminate the first script)
Thanks a lot Nehme,
You pointed me to the solution
actually I had to do the following on trigger on exiting the field script :
If [ NOT IsEmpty ( $$Exit)]
In fact, Halt script and Exit script could both work.
And you must pay attention:
When you are opening the software, $$Exit varialbe will be empty, and so, there will be no trigger because the "If" condition will not be fulfilled.
In the other hand, when you want to close the software with the Close script, the latter must stop the trigger to be able to close the program. This is why this script must set the $$Exit varialbe not to be empty.
At the end, the most important thing is that it worked.
I believe that you might be able to reduce your required scripts to just the OnExit trigger by utilizing a clever technique that Daniel Wood describes in one of his blogs.
He uses it to keep the user captive in a WebViewer object unless navigated away via a script. Though I haven't tested it, I imagine that this would work equally well to keep the user captive within a field.
Really, it is just an elaboration of what erolst already posted above.
The gist of it:
The OnExit script trigger is set up with a script parameter of Get( ScriptName ).
The condition which is then checked to determine whether or not to exit with a return value of False is whether or not Get( ScriptParameter ) contains a value.
If it contains a value, it means that another script has been invoked, and the exit return value should be True, to allow that other script to procede.
Here is a link to the blog post:
Scroll down most of the page until just below the words: "Because in this solution nothing is editable, the user has no reason to leave the web viewer..."
It is worth checking out -- it is much easier to grok from within the context of Daniel's explanation and illustration. The advantage, as I see it, is that it allows you to utilize a variety of scripts to exit the field, without having to concern yourself with updating a global variable.
Hope this helps & best,
Terrific Steve, this works like a charm. Simpler, cause only the exit script is needed.
Thanks a lot for the heads up.