Home / cat / eventdecl 
Previous  Next  Edit  Rename  Undo  Refresh  Search  Administration   
fr  de  es  it  nl  pl  pt  pt_BR  mk  ca  ar  fa  vi  ja  ru  zh  zh_TW  eo 
Documentation
History
 
Events declaration
Syntax
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) AS Boolean

...

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

Event Management