SlideShare une entreprise Scribd logo
1  sur  15
Unit 14 – Event Driven
    Programming

     What is event driven
       programming?



                            1
Key Features of EDP
1. Forms & Controls
2. Trigger functions
3. Event handlers
4. Event loops




                             2
Forms and Controls
A GUI (graphical user interface) is what the user
sees when the program runs and usually consists
of one or several forms
Each form contains various controls which
allow the user to interact with the program in
different ways e.g. Textboxes, Menus, Buttons
Each type of control has its own events e.g. a
Form events include:
   Load (open for first time, set default values)
   KeyDown (when the user presses a key)

                                                    3
Load Form




            4
Trigger functions
Event driven programs respond to events triggered
by the user via the mouse or keyboard
Common user events include clicking the mouse,
pressing a key, changing text
Different controls have different events (events for
a text box not the same for a button)
The programmer chooses which event(s) to respond
to by selecting the appropriate trigger function.



                                                       5
Button Events
Event driven programs respond to events triggered
by the user
Every object has a
range of trigger
functions – one for
each possible event
  A Button has a Click
  event, a GotFocus
  event, a MouseHover
  event etc


                                                    6
Event Handlers
An event triggers the appropriate event handler
Event handlers contain the code that runs when an
event occurs
These event handlers are self-contained sections of
code – also called Procedures or Subroutines
  VB.NET uses Sub /End Sub to start and end the code




This allows the programmer to work on one event
of one control at a time and makes testing easier
                                                       7
Event Loops
Programmers not normally aware of these
The Event loop keeps testing the user interface to
see if anything has happened (e.g. clicking on a
button or pressing a key)
When detected, the event is passed to the trigger
function which then finds the appropriate event
handler to run the code written for this purpose
Other (non user) activities can also cause an event
to trigger – typically used in networking and when
reading from or writing to files
                                                      8
Event Loop
1   User interacts with page       2   An ‘event’ is triggered


                                            EVENT!




4   The page’s appearance is       3   A code handler runs in response
    updated/modified as a result




                                                                         9
Advantages
Flexibility:
  Wide choice of controls and trigger functions
Suitability for GUI:
  uses WIMP system (Windows, Icons, Menus, Pointers)
Simplicity and Ease of development:
  Add and code one control at a time, allows a
  programmer to build up their program gradually with
  simple building blocks




                                                        10
Flexibility
Wide choice of controls – can be dragged and
dropped onto form
Good choice of trigger functions – programmer
can decide what will happen when
Programmer can assist user with intuitive
interface, restrict input to a limited range, provide
visual feedback and context-sensitive help




                                                        11
Suitable for GUIs
Are particularly suitable for event driven
programming - uses WIMP system
  Windows, Icons, Menus, Pointers
They have many objects which the programmer
can use to provide the user with alternative ways
to interact with the program (mouse or keyboard)
Most controls are independent – so code can be
naturally modular



                                                    12
Simplicity and Ease of Development

Event-driven languages such as C#, VB.NET and Visual
C++ allow a programmer to build up their program
gradually with simple building blocks
Programmers can add and code one object at a time, using
simple constructs
   Pre-written code and drop-down lists showing choice of
   possible commands
   Errors are highlighted and step through debugging
Code modules can be re-used or imported from libraries,
built-in wizards can be used
Online and local help files are readily available


                                                            13
Disadvantages
Errors can be more difficult to spot than with
simpler, procedural programs
Programs with complex GUIs may be slower to
load and run than simpler programs – particularly
if RAM is insufficient
Programs with too many forms can be very
confusing and/or frustrating for the user



                                                    14
Which control would a programmer
            use to….?
Allow a Yes/ No answer only?
Allow a wide range of keyboard input?
Limit user input to the numbers 1, 2, 3 & 4?
Allow a user to subtly change the colour or
brightness selected in a graphics application
Allow a user to access commands without
the mouse, but using keyboard navigation
only?

                                                15

Contenu connexe

Tendances

System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7koolkampus
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programmingChaffey College
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface Bivek Pakuwal
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box TestingTestbytes
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object ModelWebStackAcademy
 
Practical file on web technology(html)
Practical file on web technology(html)Practical file on web technology(html)
Practical file on web technology(html)RAJWANT KAUR
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in androidPrawesh Shrestha
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE IntroductionAhllen Javier
 
Graphical User Interface (GUI)
Graphical User Interface (GUI)Graphical User Interface (GUI)
Graphical User Interface (GUI)Estiak Khan
 
User Interface Analysis and Design
User Interface Analysis and DesignUser Interface Analysis and Design
User Interface Analysis and Design Saqib Raza
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events WebStackAcademy
 

Tendances (20)

Html frames
Html framesHtml frames
Html frames
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 
System Models in Software Engineering SE7
System Models in Software Engineering SE7System Models in Software Engineering SE7
System Models in Software Engineering SE7
 
Ch 3 event driven programming
Ch 3 event driven programmingCh 3 event driven programming
Ch 3 event driven programming
 
visual basic programming
visual basic programmingvisual basic programming
visual basic programming
 
Graphical User Interface
Graphical User Interface Graphical User Interface
Graphical User Interface
 
Black Box Testing
Black Box TestingBlack Box Testing
Black Box Testing
 
Web controls
Web controlsWeb controls
Web controls
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
 
Practical file on web technology(html)
Practical file on web technology(html)Practical file on web technology(html)
Practical file on web technology(html)
 
Vbscript
VbscriptVbscript
Vbscript
 
Html forms
Html formsHtml forms
Html forms
 
Introduction to fragments in android
Introduction to fragments in androidIntroduction to fragments in android
Introduction to fragments in android
 
State chart diagram
State chart diagramState chart diagram
State chart diagram
 
PHP FUNCTIONS
PHP FUNCTIONSPHP FUNCTIONS
PHP FUNCTIONS
 
Html Frames
Html FramesHtml Frames
Html Frames
 
Visual Basic IDE Introduction
Visual Basic IDE IntroductionVisual Basic IDE Introduction
Visual Basic IDE Introduction
 
Graphical User Interface (GUI)
Graphical User Interface (GUI)Graphical User Interface (GUI)
Graphical User Interface (GUI)
 
User Interface Analysis and Design
User Interface Analysis and DesignUser Interface Analysis and Design
User Interface Analysis and Design
 
JavaScript - Chapter 11 - Events
 JavaScript - Chapter 11 - Events  JavaScript - Chapter 11 - Events
JavaScript - Chapter 11 - Events
 

En vedette

Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+featuresFaisal Aziz
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballsMsWillcox
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programmingAshwini Awatare
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven ProgrammingAmazon Web Services
 
TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9Nuno Godinho
 
Service oriented programming with jolie part1
Service oriented programming with jolie part1Service oriented programming with jolie part1
Service oriented programming with jolie part1Anh Nguyen
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of codeShwe Yee
 
Regulace v sektoru elektronických komunikací
Regulace v sektoru elektronických komunikacíRegulace v sektoru elektronických komunikací
Regulace v sektoru elektronických komunikacíCTU_cz
 
Nurses then & now assign. 5 technology
Nurses then & now assign. 5 technologyNurses then & now assign. 5 technology
Nurses then & now assign. 5 technologyboerigter
 
Power point 5
Power point 5Power point 5
Power point 5boerigter
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAmazon Web Services
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecyclenicky_walters
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof languagenicky_walters
 

En vedette (20)

Event+driven+programming key+features
Event+driven+programming key+featuresEvent+driven+programming key+features
Event+driven+programming key+features
 
Event driven programming amazeballs
Event driven programming amazeballsEvent driven programming amazeballs
Event driven programming amazeballs
 
Event oriented programming
Event oriented programmingEvent oriented programming
Event oriented programming
 
(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming(WRK302) Event-Driven Programming
(WRK302) Event-Driven Programming
 
Delphi L01 Intro
Delphi L01 IntroDelphi L01 Intro
Delphi L01 Intro
 
TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9TechDays 2010 Portugal - Event Driven Architectures - 16x9
TechDays 2010 Portugal - Event Driven Architectures - 16x9
 
Service oriented programming with jolie part1
Service oriented programming with jolie part1Service oriented programming with jolie part1
Service oriented programming with jolie part1
 
Importance of the quality of code
Importance of the quality of codeImportance of the quality of code
Importance of the quality of code
 
Regulace v sektoru elektronických komunikací
Regulace v sektoru elektronických komunikacíRegulace v sektoru elektronických komunikací
Regulace v sektoru elektronických komunikací
 
Nurses then & now assign. 5 technology
Nurses then & now assign. 5 technologyNurses then & now assign. 5 technology
Nurses then & now assign. 5 technology
 
Power point 5
Power point 5Power point 5
Power point 5
 
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDBAWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
AWS December 2015 Webinar Series - Design Patterns using Amazon DynamoDB
 
Iconography of music videos
Iconography of music videos Iconography of music videos
Iconography of music videos
 
Decisions
DecisionsDecisions
Decisions
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Design for edp
Design for edpDesign for edp
Design for edp
 
Software development lifecycle
Software development lifecycleSoftware development lifecycle
Software development lifecycle
 
Data structures vb
Data structures vbData structures vb
Data structures vb
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 

Similaire à Event driventheory

SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Designghayour abbas
 
Publication Non Visual Components
Publication Non Visual ComponentsPublication Non Visual Components
Publication Non Visual Componentssatyres
 
Synapse india reviews on gui programming in .net
Synapse india reviews on gui programming in .netSynapse india reviews on gui programming in .net
Synapse india reviews on gui programming in .netsaritasingh19866
 
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRohit Radhakrishnan
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0DivyaR219113
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System RequirementsLaura Arrigo
 
Human Computer Interaction
Human Computer InteractionHuman Computer Interaction
Human Computer InteractionBHAKTI PATIL
 
Operating Systems
Operating SystemsOperating Systems
Operating SystemsLeon Lei
 
Discuss how each of the following Java components will assist in creat.docx
Discuss how each of the following Java components will assist in creat.docxDiscuss how each of the following Java components will assist in creat.docx
Discuss how each of the following Java components will assist in creat.docxwviola
 
Embedded Systems.pdf
Embedded Systems.pdfEmbedded Systems.pdf
Embedded Systems.pdfruvabebe
 
Modelling Feature Interaction Patterns in Nokia Mobile Phones.
Modelling Feature Interaction Patterns in Nokia Mobile Phones.Modelling Feature Interaction Patterns in Nokia Mobile Phones.
Modelling Feature Interaction Patterns in Nokia Mobile Phones.pradeepmondal
 
2 working with operating system
2 working with operating system2 working with operating system
2 working with operating systemMukesh Thakur
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docPalakjaiswal43
 

Similaire à Event driventheory (20)

Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
Unit-1.pptx
Unit-1.pptxUnit-1.pptx
Unit-1.pptx
 
Unit 2
Unit 2Unit 2
Unit 2
 
SWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface DesignSWE-401 - 8. Software User Interface Design
SWE-401 - 8. Software User Interface Design
 
Publication Non Visual Components
Publication Non Visual ComponentsPublication Non Visual Components
Publication Non Visual Components
 
Synapse india reviews on gui programming in .net
Synapse india reviews on gui programming in .netSynapse india reviews on gui programming in .net
Synapse india reviews on gui programming in .net
 
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath SelectorsRPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
RPA Developer Kickstarter | Day 3: UI Automation and UiPath Selectors
 
Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0Introduction to Visual Basic 6.0
Introduction to Visual Basic 6.0
 
Functional Requirements Of System Requirements
Functional Requirements Of System RequirementsFunctional Requirements Of System Requirements
Functional Requirements Of System Requirements
 
Human Computer Interaction
Human Computer InteractionHuman Computer Interaction
Human Computer Interaction
 
2.5 gui
2.5 gui2.5 gui
2.5 gui
 
Pc03
Pc03Pc03
Pc03
 
Operating Systems
Operating SystemsOperating Systems
Operating Systems
 
Discuss how each of the following Java components will assist in creat.docx
Discuss how each of the following Java components will assist in creat.docxDiscuss how each of the following Java components will assist in creat.docx
Discuss how each of the following Java components will assist in creat.docx
 
Embedded Systems.pdf
Embedded Systems.pdfEmbedded Systems.pdf
Embedded Systems.pdf
 
Modelling Feature Interaction Patterns in Nokia Mobile Phones.
Modelling Feature Interaction Patterns in Nokia Mobile Phones.Modelling Feature Interaction Patterns in Nokia Mobile Phones.
Modelling Feature Interaction Patterns in Nokia Mobile Phones.
 
2 working with operating system
2 working with operating system2 working with operating system
2 working with operating system
 
Working with Operating System
Working with Operating SystemWorking with Operating System
Working with Operating System
 
Events vs Notifications
Events vs NotificationsEvents vs Notifications
Events vs Notifications
 
ANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.docANDROID LAB MANUAL.doc
ANDROID LAB MANUAL.doc
 

Plus de nicky_walters (15)

Design documentation
Design documentationDesign documentation
Design documentation
 
Pseudocode flowcharts
Pseudocode flowchartsPseudocode flowcharts
Pseudocode flowcharts
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Data types vbnet
Data types vbnetData types vbnet
Data types vbnet
 
Ndu06 typesof language
Ndu06 typesof languageNdu06 typesof language
Ndu06 typesof language
 
Simple debugging
Simple debuggingSimple debugging
Simple debugging
 
Debugging
DebuggingDebugging
Debugging
 
Using loops
Using loopsUsing loops
Using loops
 
Input output
Input outputInput output
Input output
 
Decisions
DecisionsDecisions
Decisions
 
Controls
ControlsControls
Controls
 
Decisions
DecisionsDecisions
Decisions
 
Intro to visual studio 2008
Intro to visual studio 2008Intro to visual studio 2008
Intro to visual studio 2008
 
Input output
Input outputInput output
Input output
 

Event driventheory

  • 1. Unit 14 – Event Driven Programming What is event driven programming? 1
  • 2. Key Features of EDP 1. Forms & Controls 2. Trigger functions 3. Event handlers 4. Event loops 2
  • 3. Forms and Controls A GUI (graphical user interface) is what the user sees when the program runs and usually consists of one or several forms Each form contains various controls which allow the user to interact with the program in different ways e.g. Textboxes, Menus, Buttons Each type of control has its own events e.g. a Form events include: Load (open for first time, set default values) KeyDown (when the user presses a key) 3
  • 5. Trigger functions Event driven programs respond to events triggered by the user via the mouse or keyboard Common user events include clicking the mouse, pressing a key, changing text Different controls have different events (events for a text box not the same for a button) The programmer chooses which event(s) to respond to by selecting the appropriate trigger function. 5
  • 6. Button Events Event driven programs respond to events triggered by the user Every object has a range of trigger functions – one for each possible event A Button has a Click event, a GotFocus event, a MouseHover event etc 6
  • 7. Event Handlers An event triggers the appropriate event handler Event handlers contain the code that runs when an event occurs These event handlers are self-contained sections of code – also called Procedures or Subroutines VB.NET uses Sub /End Sub to start and end the code This allows the programmer to work on one event of one control at a time and makes testing easier 7
  • 8. Event Loops Programmers not normally aware of these The Event loop keeps testing the user interface to see if anything has happened (e.g. clicking on a button or pressing a key) When detected, the event is passed to the trigger function which then finds the appropriate event handler to run the code written for this purpose Other (non user) activities can also cause an event to trigger – typically used in networking and when reading from or writing to files 8
  • 9. Event Loop 1 User interacts with page 2 An ‘event’ is triggered EVENT! 4 The page’s appearance is 3 A code handler runs in response updated/modified as a result 9
  • 10. Advantages Flexibility: Wide choice of controls and trigger functions Suitability for GUI: uses WIMP system (Windows, Icons, Menus, Pointers) Simplicity and Ease of development: Add and code one control at a time, allows a programmer to build up their program gradually with simple building blocks 10
  • 11. Flexibility Wide choice of controls – can be dragged and dropped onto form Good choice of trigger functions – programmer can decide what will happen when Programmer can assist user with intuitive interface, restrict input to a limited range, provide visual feedback and context-sensitive help 11
  • 12. Suitable for GUIs Are particularly suitable for event driven programming - uses WIMP system Windows, Icons, Menus, Pointers They have many objects which the programmer can use to provide the user with alternative ways to interact with the program (mouse or keyboard) Most controls are independent – so code can be naturally modular 12
  • 13. Simplicity and Ease of Development Event-driven languages such as C#, VB.NET and Visual C++ allow a programmer to build up their program gradually with simple building blocks Programmers can add and code one object at a time, using simple constructs Pre-written code and drop-down lists showing choice of possible commands Errors are highlighted and step through debugging Code modules can be re-used or imported from libraries, built-in wizards can be used Online and local help files are readily available 13
  • 14. Disadvantages Errors can be more difficult to spot than with simpler, procedural programs Programs with complex GUIs may be slower to load and run than simpler programs – particularly if RAM is insufficient Programs with too many forms can be very confusing and/or frustrating for the user 14
  • 15. Which control would a programmer use to….? Allow a Yes/ No answer only? Allow a wide range of keyboard input? Limit user input to the numbers 1, 2, 3 & 4? Allow a user to subtly change the colour or brightness selected in a graphics application Allow a user to access commands without the mouse, but using keyboard navigation only? 15