Event+driven+programming key+features

9
Event Driven Programming Key Features

Transcript of Event+driven+programming key+features

Page 1: Event+driven+programming key+features

Event Driven Programming

Key Features

Page 2: Event+driven+programming key+features

Event Driven Programs

Typically used for most modern day software applications examples include: word processing, spreadsheets, drawing packages etc.

Usually used for GUIs where many types of events are generated i.e. clicking on a button or another object

Page 3: Event+driven+programming key+features

Key features

Event HandlersTrigger FunctionsEventsEvent LoopsFormsFlexibilityService orientedSuitability for GUIsSimplicity of programmingTime Driven

Page 4: Event+driven+programming key+features

Event Handlers

VB.Net uses subroutines for event handling, with the name of the object followed by the name of the event – see below:

Event Handler

Event

Page 5: Event+driven+programming key+features

ByVal means it is passing the variable by value. sender is an object of type System.Object.  All objects in .NET

inheirit from System.Object, as such it is passing the control that is causing the event to fire.

e is an object of type System.EventArgs where EventArgs is the Class for event arguments or, the arguments the event is passed.

It contains information you need to process the event. The information available depends on the type of event that was raised. Since the members available through the "e" argument depend on the kind of action that raised the event, it is important to use an event that provides the information you're interested in.

Page 6: Event+driven+programming key+features
Page 7: Event+driven+programming key+features

Trigger functions

These are used along with the object’s name to determine with event handler to run

Every object has a range of trigger functions, one for each possible event that can happen to it. For example, txtText could have an event handler for the following triggers: GotFocus, TextChanged etc...

Temporal triggers mean triggers set off by duration of time State triggers are when the current situation causes a certain set of procedures to run

What is the trigger here??

Page 8: Event+driven+programming key+features

Event Loops

Event Driven Programs have event loops built into the environment. The loops keep testing the interface to detect whether anything has happened, such as clicking on a button or typing into a textbox etc.

Event Loops are also known as event listeners

Page 9: Event+driven+programming key+features

Flexibility

Programmers have erroneous control over where to place code and how to start it.

Every object has a good choice of events that a program can respond to. These events give an excellent level of control over exactly what the program will respond to when the user does something