executeasap
CODE
The executeasap statement executes the specified code at the first possible opportunity, non-atomically.
Parameters
This statement has one parameter:
code – code to execute in the next run loop.
Description
This statement executes the specified code at the first possible opportunity. The code will be executed non-atomically, so it is always allowed to display data changes, switch window configurations, and save datatabases.
Usually the only reason to use this statement is to allow atomic code to trigger non-atomic code (see Understanding the Run Loop). For example, suppose you want a dialog sheet to appear asking for a name every time a new record is added to a database. You can’t normally do this with the .NewRecord
procedure, because that procedure is not allowed to open new windows with a statement like gettextdialog. But by using the executeasap statement, you can postpone the operation of the gettextdialog for a fraction of a second, until after Panorama has finished creating the new record. At that point it is safe to do whatever you want.
executeasap {gettextdialog Name,
"Prompt","Enter this person's name",
"Sheet","YES",
"Button","Enter","AbortButton","Cancel",
"Width",300}
Though the executeasap statement makes it safe to do whatever you want, we recommend that you think long and hard about whether you really want your database to work in this unusual way. If you need to use the executeasap statement to accomplish your task, you are probably creating a very non-standard user interface that probably goes against the best modern practices in UI design.
Also if you’re not careful, the executeasap statement could get you into an endless loop that can only be cut short by forcing Panorama to quit. For example, suppose you put the code above into an execute( formula in a text display object. Simply displaying the object would trigger the dialog, then closing the dialog would display the object again, opening the dialog again, ad infinitum. So look out for this situation.
See Also
- Automatic Field Code -- running a short program when data is entered into a field.
- call -- allows a procedure to call a separate procedure within the current database as a subroutine.
- call( -- allows a procedure to be called as a subroutine within a formula and return a result.
- calledby( -- returns true if this function is in code called by the specified database, the specified procedure, or both.
- callingdatabase( -- returns the name of the database that called this procedure as a subroutine, if any.
- callingprocedure( -- returns the name of the procedure that called this procedure as a subroutine, if any.
- callwithin -- allows a procedure to call a mini-procedure within a separate procedure within the current database as a subroutine.
- callwithin( -- allows a "mini-procedure" to be called as a subroutine within a formula and return a result.
- callwithindatabase( -- returns true if the current procedure was called by another procedure in the same database, false if it was called by a procedure in another database.
- changetimer -- modifies a repeating task that will be performed periodically when Panorama is not otherwise busy.
- Custom Statements -- creating your own custom statements that can be used in your code.
- endnoshow -- resumes the output of text and graphics after it has been disabled with the noshow statement.
- execute -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
- execute( -- allows a formula to execute a sequence of statements and return a result.
- executecatcherrors -- is the same as the execute statement, except for the fact that if an error occurs while running, it can be trapped by an if error statement immediately following the executecatcherrors statement.
- executelocal -- is the same as the execute statement, but it shares local variables with the procedure that called it.
- farcall -- allows a procedure to call a separate procedure within a different database as a subroutine.
- farcallwithin -- allows a procedure to call a mini-procedure within a separate procedure in a different database as a subroutine.
- getproceduretext( -- gets the contents (source code) of a procedure.
- Implicitly Triggered Procedures -- Procedures that are triggered automatically when the user performs some normal Panorama action are said to be "implicitly triggered."
- info("computername") -- returns the name of the computer (as set up in the System Preferences Sharing panel).
- info("noshow") -- returns true if noshow is currently turned on, false if it is not.
- info("parameters") -- returns the number of parameters passed to a subroutine.
- info("procedurestack") -- returns the contents of Panorama's procedure call stack.
- info("runningatomic") -- returns true if the current procedure is running as an "atomic" procedure.
- noshow -- temporarily disables the output of text and graphics.
- parameter( -- is used to transfer data between a main procedure and a subroutine.
- parameterentity( -- returns the entity (field or variable) associated with a subroutine parameter, if any.
- resumeaftertask -- resumes after a waitfortask statement.
- return -- ends a subroutine.
- returnerror -- passes an error back to the current subroutines calling procedure.
- setparameter -- is used to transfer data from a subroutine back to the main
procedure that called it.
- setwaitinglocal -- assigns a value to a local variable in the parent procedure of an asynchronous task, allowing the asynchronouse code to pass a value back to the code that spawned it.
- shortcall -- allows a procedure to call a sequence of statements within the current procedure as a "mini-subroutine".
- starttimer -- sets up and starts a repeating task that will be performed periodically when Panorama is not otherwise busy.
- Timer Workshop -- provides a tool for monitoring timers and testing timer configurations.
- timerexists( -- checks to see whether a timer exists.
- Timers -- executing recurring periodic background code at fixed intervals.
- Understanding the Run Loop -- explanation of how Panorama code interacts with the run loop to respond to mouse clicks, keyboard presses, display updates and other events that require attention.
- wait -- pauses the program for a specified period of time.
- waitfortask -- temporarily pauses a procedure until the specified task is complete.
History
10.2 | New | New in this version. |