Windows: A distinction between an event and a function.
Your own custom events and functions are helpful at times to include
in your applications. But , when and why should they be developed
into an application ? Is there a difference between an event or a function ?
Definition statement:
Events and Functions are different levels of processing in terms of use
in an application. Each though, is significant.
Events:
An event interacts with the Operating System to communicate its messages.
It states what is going on while the application is running. As with guages on
your car, they tell you what is happening with the car while it is in use.
In response to an event the developer and user know when something has
happened as well and can make something else happen during or following an
event action.
A function too, relys on the underlying functionality of the O.S. but its
use is specific to a different purpose. Functions are responsible for
Input, processing and output of data (in whatever format) the user
specifies and is part of the applications purpose. They are usually placed
inside or respond to events to do this.
Event use:
If you look in the visual components events tab you will find a listing
of events. Each component has any number of events associated with
it and they are message recognitions which can take place in cycles.
The onmousedown - onclick - onmouseup are events and examples of a
events which work together to create a process cycle.
Events in component terms.
Cycles or groups of events are part of an "Interface" mechanism and
can be associated with a component. Components may be visual or
non-visual. A TTimer component is a non-visual component and a button
is visual. Each have events.
Example: TButton and User recognitions
The user knows what has happened because of the change of physical
features the button displays given onfocus, onmousedown,onclick,onmouseup events.
The computer knows as well for the similar reasons. In each event, something
happens so that something else can happen until the process cycle
of events has completed.
Function level purpose:
A function may be considered otherwise. It too, sends messages to and
from the O.S. These messages for the most part usually interact with
an applications Input, processing and Output process requirements.
This process is focused on data processing and not so much mechanisms
which make up the applications visual and nonvisual Interface.
Another distinction is the process of each as provided within an applications
regular processes. An event may be called of another components event
from within an event. This event will continue to allow for the completion
of its cycle of events while allowing other events to occur. A function on
the other hand in general terms, is called from within an event and must
complete its processing before it will exit that event.
Consider a Timers OnTimer event being enabled from within a Buttons OnClick event.
Any other event associated with the Button component or for that matter
any other components events will occur WHILE the processing of the Timer happens .
However, all processes will be interrupted when the activation of
Interval properties value is due to process the OnTimer event.
Events handle functionality and are an integral part to application development.
Keep on Building
David W. Stubbs