The system generates events associated, for example, with mouse clicks.
Is it possible to generate your own kind of events based on some type of occurence. For example, you are reading a character at a time from some input, and you want to generate an event when the input satisfies some condition (perhaps when it is a vowel).
Say you are reading characters and you want to generate an event (call it "gotIT") whenever you read the character "X" or you are reading a sequence of numbers and whenever a peak is detected (say you read 10 20 15) once you have read the number 15 you realize that there was a peak at number 20 and you want to "fire" an event called "gotPeak".
The next question would be that if it is possible to do so, how do you hook the event to some function (the Event Handler). In other words, how would you have a function register to be called whenever the "gotPeak" event is fired?
In this way, as you come up with other event handlers for that event, you simply register them with that event and each function registered with event "gotPeak" will get called whenever "gotPeak" is fired.