Unit 14 p1
Unit 14 p1
3. Event Loops:
Event loops are built into the programming language to constantly check
if an event has occurred or not. Event driven programming languages are
required to have event loops built into them at a level a programmer
would be aware. Event loops are required to keep testing whether
anything has happened to the user interface, such as clicking on a button
to check if it works or typing into a text box to check if text can be
entered. If an event is detected, it is passed to the trigger functions, which
Akash Patel
then call the required event handler to run any code that was designed
and written for the event.
4. Trigger Functions:
Most event driven programming language users trigger functions to
choose which event handler to be ran for the event that has been carried
out. Each object has its own set of trigger functions, objects have one
trigger function for each possible event that is likely to occur. Trigger
functions are mechanisms that decide which code runs when an event
occurs.
5. Event handlers:
This is the code that runs when an event occurs.
How the main features all come together:
The above shows all the features coming together and being carried out in
a set order. The first step is the event that occurs which in this case is the
mouse click, one the click occurs it leads to a trigger function which then
decides what code is required to run. This then carries on to the event
handler as this is the code that runs when an event occurs.