0% found this document useful (0 votes)
1K views2 pages

Unit 14 p1

Event driven programs are made up of small sections of code that are run when events occur, like clicking a button or selecting a menu option. These events trigger functions that carry out particular tasks. Key aspects of event driven programs include forms that contain controls like buttons, events like mouse clicks or key presses, event loops that constantly check for events, trigger functions that determine which event handler code runs, and event handlers, which is the code executed in response to an event. Together, these elements allow a program to respond dynamically to user input events.

Uploaded by

api-319906681
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
1K views2 pages

Unit 14 p1

Event driven programs are made up of small sections of code that are run when events occur, like clicking a button or selecting a menu option. These events trigger functions that carry out particular tasks. Key aspects of event driven programs include forms that contain controls like buttons, events like mouse clicks or key presses, event loops that constantly check for events, trigger functions that determine which event handler code runs, and event handlers, which is the code executed in response to an event. Together, these elements allow a program to respond dynamically to user input events.

Uploaded by

api-319906681
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Akash Patel

Unit 14- P1.


Event driven programs are made up of small sections of code which are
run when something called an event occurs. Events are actions taking
place for example clicking a button using the mouse or selecting a menu
option. The event triggers a program to carry out a particular function.
Event driven programs are used with GUI operating systems, where
different types of events are created, such as a user clicking on a button
or another object. Uses of event driven programs include word processors,
spreadsheets, databases and drawing packages.
Key characteristics of EDP:
1. Forms:
Forms could be used to contain controls which are also known as objects
which experience events for example a button. Forms are a major feature
of all event driven programming environments, as that is what the user
sees when the program is being run. Forms are a type of control which
means that a collection of events may be used by the programmer. These
forms events are a very good way of controlling a program. Two examples
of form event is load and activated.
Load is the event that occurs when a form is initially used. Load event is
useful when code needs to set variables.
Activated is an event that occurs whenever a form receives the focus
(when it is loaded). The activated event is helpful when updating a form
when the user returns to it from a different form.
2. Events:
Events are action which a program will respond to for example clicking the
mouse on a control. There are numerous events that can trigger an event
handler to run. For example:

Keyboard events include key press, key up and down.


HTML object events include clicking on an object that may connect
to a web page that has been linked.
Mouse events include right click, left click and hover.

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.

You might also like