This declares a class event. This event is raised by a function call.
You can specify if the event handler returns a boolean value. In that case, a TRUE
return value indicates that the event has been cancelled.
EVENT BeforeSend(Data AS String) AS Boolean ... DIM bResult AS Boolean ' Raises the event RAISE BeforeSend("MyData") AS bResult IF bResult THEN PRINT "Canceled !" ENDIFBy default, "InstanceName_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(your args...)
The default behavior can be changed somewhat: see Attach and other methods of the static Object class, as well as Control Groups whose information is applicable to any event-raising class.