Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Arithmetical Functions
Arithmetic Operators
Array Declaration
Assignment Operators
Binary Data Representation
Bits Manipulation Functions
Character Test Functions
Comparison methods
Complex numbers
Constant Declaration
Constant Expression
Conversion Functions
Datatype Functions
Date & Time Functions
Enumeration declaration
Error Management
Event Loop
Event Management
Events declaration
External Function Management
File & Directory Functions
File & Directory Paths
File mode syntax
Floating Point Numbers
Formatting functions
Gambas Object Model
Global Special Event Handlers
Integer numbers
Intrinsic Functions
Language Constants
Localization and Translation Functions
Local Variable Declaration
Logarithms & Exponentials Functions
Logical Operators
Loop Control Structures
Method Declaration
Miscellaneous Control Structures
Miscellaneous Functions
Native Arrays
Native Container Classes
Object & Class Management
Operator Evaluation Order
Predefined Constants
Process Management
Property Declaration
Random Numbers Functions
Special Methods
Stream & Input/Output functions
String Functions
String Operators
Structure declaration
Test Control Structures & Functions
Trigonometric Functions
User-defined formats
Using reserved keywords as identifiers
Variable Declaration
Last Changes
Search the wiki
To Do
Wiki License
Wiki Manual

Global Special Event Handlers

The global special event handlers implement specific global interpreter features.

They must be defined in the startup class as static methods to be taken into account.


Public Sub Application_Read()

Catches data sent to the standard input.

If that static method is defined in the project startup class, then the standard input is watched by the interpreter, and the method is called each time there is something to read on the standard input.


Public Sub Application_KeyPress()

This handler is defined by GUI components. It intercepts every key press sent to the application.

If you stop the event, the key press will be ignored.


Public Sub Application_Error()

Since 3.5

This handler is called when an error is raised and is not handled by any CATCH, TRY or FINALLY instruction.


Public Sub Application_Log(Text As String, Where As String)

Since 3.19

This handler intercepts each call to the ERROR or DEBUG instruction.

  • Text is the text printed by the entire instruction line.

  • Where is what Debug prints before the text. It is void when the Error instruction is used.

If the standard error output is redirected by ERROR TO, Application_Log will not catch the printed text.