Xbasic

ON_XBASIC_IDLE Function

Syntax

V ON_XBASIC_IDLE(C code[,C flags])

Arguments

code

The Xbasic code to be run placed into a character string.

flags

"R" = If you register duplicate code, Alpha Anywhere only executes the code once. "N" = Use this flag when issuing the command from a modal dialog box.

Description

The ON_XBASIC_IDLE() function register Xbasic code that will be run the next time Alpha Anywhere is idle. (i.e. after any scripts that are running asynchronously have finished). You would typically use this command if you have script that is running into timing problems. To run code when Xbasic is not busy executing use flags R-epeat suppress, N-ested idles. The suppress repeats flag doesn't add the code if the exact same code is already scheduled.

Discussion

Example 

This example calls on_Xbasic_idle() twice with the same code, but the code block executes only once (assuming that there was no idle after the first on_Xbasic_idle() was called, which there wouldn't have been).

codeTxt = 
 file.remove(tempfilename) 
 %code% 


 on_Xbasic_idle(codeTxt,"R") 
 on_Xbasic_idle(codeTxt,"R")

Limitations

Desktop applications only.

See Also