Events Overview

This cluster contains classes for event handling within Vision2.  To view the classes contained in the the events cluster click here.

What is an event?

An event is considered to be an external action that occurs during a program's execution. Correctly dealing with events is an important part of developing a Vision2 application. For example, if a user clicks on a button, you will want to respond to this event by calling a routine that deals with the request.  Vision2 contains action sequences for all kinds of widget events, to view the kind of events available to every widget, click here.

How do I connect to an event?

Every widget and item has an action sequence associated with it that relates to some kind of event, for example an EV_BUTTON has a select_actions action sequence.  This gets fired when the user clicks/selects the button.  To have a procedure called on this event, you need to create an agent based on this procedure, and then add this to the action sequence (via extend).  For a more detailed description of agents and their uses click here.

 

An example of adding an agent to an action_sequence is as follows.

 

button.select_actions.extend (agent print ("Button Clicked!%N"))

 

All Vision2 action sequences inherit EV_ACTION_SEQUENCE and when it is called, all of the agents held within are fired, thus calling all of the procedures represented by the agents. The signature of any agent that you place in an action sequence must conform to those of the action sequences actual generic parameter.  

When you want an agent to be called from a certain action sequence and the signatures do not match, you may use force_extend, this will call your agent but has no guarantees on the arguments passed to your procedure.