Gambas Documentation
Application Repository
Code Snippets
Compilation & Installation
Components
Controls pictures
Deprecated components
Developer Documentation
Development Environment Documentation
Documents
Error Messages
Gambas Playground
How To's
Language Index
Language Overviews
Arithmetical Functions
Arithmetic Operators
Array Declaration
Assignment Operators
Assignments
Binary Data Representation
Bits Manipulation Functions
Character Test Functions
Comparison methods
Complex numbers
Constant Declaration
Constant Expression
Conversion Functions
Datatype Functions
Datatypes
Date & Time Functions
Enumeration declaration
Error Management
Event Loop
Event Management
Events declaration
Expressions
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
Lexicon
README
Search the wiki
To Do
Topics
Tutorials
Wiki License
Wiki Manual

Events declaration

EVENT Name ( [ Parameter #1 [ , Parameter #2 ... ] )

This declares a class event. This event is raised by using the RAISE keyword.

The RAISE keyword may return a boolean value to indicate if the event handler wants to cancel the event.

Examples

EVENT BeforeSend(Data AS String)

...

DIM bResult AS Boolean

' Raises the event

bResult = RAISE BeforeSend("MyData")

IF bResult THEN
  PRINT "Canceled !"
ENDIF

Event Handler

By default, Name_EventName is the name of the method called in the event listener when an event is raised.

For example, if you have a class called FancyButton and you throw an event called FancyClick, and if in your form called FMain you have a FancyButton object named MyButton, the event handler method would look like this:

PUBLIC SUB MyButton_FancyClick(...)

The default behavior can be changed somewhat: see Object.Attach and other methods of the static Object class, as well as control groups whose information is applicable to any event-raising class.

See also