#Pragma Directive

Used to speed up code execution by turning off certain automatic tasks. When a pragma directive is used, the automatic task remains off until the end of the method in which it is called (or is enabled by calling it again and specifying True), but not in other methods that might be called within the original method.

# Notes

#pragma Directive

or

#pragma Directive True or False

Directive | Description
--- | ---
BackgroundTasks | Enables or disables auto-yield to background threads. In addition to the pragma directive, specify True or False. Setting this directive to False is the same as using disableBackgroundTasks)
BindingSpecification | Used in custom object binds to specify the object types being bound and the text to be presented in the Object Bindings dialog at the time the binding is being created. The first two parameters passed are the object types in the bind and the third is the string that is presented in the Object Types dialog box. The two objects are referred to in the string as %1 and %2 respectively.
BoundsChecking | Enables or disables bounds checking. In addition to the pragma directive, specify True or False. Specifying False is the same as using disableBoundsChecking.
DisableAutoWaitCursor | Used to disable the automatic display of the wait cursor (or watch cursor). In versions 5.0 and above, the scope of this pragma is no longer global. The wait cursor will be disabled in the method that calls the pragma until the method ends. For example, if DisableAutoWaitCursor is called in a Pushbutton that runs a loop, the wait cursor will be disabled only until the loop runs and the Action event has completed.
DisableBackgroundTasks | Used to turn off automatic background task handling for code after the #pragma. It prevents REALbasic from yielding time back to the operating system, other applications, and threads. It can speed up very processor-intensive operations but prevents REALbasic from displaying the Watch cursor, may halt normal background updating of interface elements, and prevents other threads from executing.
DisableBoundsChecking | Used to turn off array bounds checking on array index values in code after the #pragma.
NilObjectChecking | Controls whether to automatically check objects for Nil before accessing properties and calling methods. In addition to the pragma directive, specify True or False.
StackOverflowChecking | Controls whether to check for stack overflows. In addition to the pragma directive, specify True or False.
X86CallingConvention | Accepts either StdCall or CDecl, not True or False. Allows you to determine which calling convention a method will be compiled with on x86. This allows you to write callback functions on Windows, which typically require the StdCall calling convention.

Four pragma directives require that you pass True or False to turn the option on or off. Since these pragmas can be enabled or disabled, you can now do things like disable background tasks for an inner loop, but leave them enabled for the outer loop:

For y = 0 To Height
#pragma BackgroundTasks False
For x = 0 To Width
//...process some pixels...
Next
#pragma BackgroundTasks True
Next

# Example

The following #pragma is used in the Bind method of the BindingInterface class interface to bind a PushButton to a ListBox.

#pragma bindingSpecification PushButton,ListBox, _
"Delete all rows in %2 when %1 is pushed."