UserCancelled

From Xojo Documentation


Method

Used to determine if the user has pressed Escape (on Windows or Linux) or Command-period (on macOS) or to cancel the execution of code.

Syntax

result = UserCancelled

Part Type Description
result Boolean Result is True if the user has pressed Escape (on Windows or Linux) or Command-period (on macOS) or and False if the user did not cancel.

Notes

The UserCancelled function will continue to return True until the event handler that was executing when the user pressed Escape or Command-period is finished.

Examples

This example uses the UserCancelled function to exit a For loop if the user presses Command-period/Escape.

Const kMax = 10000000

For i As Integer = 0 To kMax
ProgressBar1.Value = (i / kMax) * ProgressBar1.Maximum
If UserCancelled Then
Exit
End If
Next

See Also

Exit, Do...Loop, For...Next, While...Wend statements; Application class.