Event-driven programming. Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen.

Slides:



Advertisements
Similar presentations
What Was I Thinking??. Key Terms 1. Control 1. Control 2. Design Mode 2. Design Mode 3. Event 3. Event 4. Form 4. Form 5. Interface 5. Interface 6. Properties.
Advertisements

Understanding an Apps Architecture ASFA Computer Science: Principles Fall 2013.
Windows Basics An Introduction to the Windows Operating System.
Objects in Alice: Positioning and Moving Them By Jenna Hayes under the direction of Professor Susan Rodger Duke University July
An Introduction to Visual Basic Terms & Concepts.
CS0004: Introduction to Programming Visual Studio 2010 and Controls.
Events Chapter 7. Interactive Real world is interactive User determines order of actions instead of programmer.
Microsoft® Small Basic
XP Tutorial 4 New Perspectives on Microsoft Windows XP 1 Microsoft Windows XP Personalizing Your Windows Environment Tutorial 4.
Interfacing with Computer Associate Degree in Education (ADE) Lecture 04 Sajid Riaz.
© by Pearson Education, Inc. All Rights Reserved.
Basic Orientation for 3D Animation (Y-Up Version)
Automating Tasks With Macros
Exploring Events. Try this Start Alice and create a blank world using the grass template. Add an instance of a BlueBallerina. Add an instance of a PinkBallerina.
CS320n –Visual Programming Interactive Programs Mike Scott (Slides 5-1)
Programming in Alice Chapter 2 Part 2. Events Editor Identifies what method is executed (run) when the “Play” button is hit 2.
Alice 2.0 Introduction to Event-Driven Programming Mr. Planck.
MCT260-Operating Systems I Operating Systems I Interfaces to Operating Systems.
CP1610: Introduction to Computer Components
Introduction to Visual Basic. What is Visual Basic? An environment for developing Windows applications Components –A GUI (Graphical User Interface - gooey)
Intermediate GNVQ ICT Input Devices and Methods Manual input devices are used by people to enter data by hand. Keyboard Pointing devices Joystick Digital.
GCSE Information Technology Input Devices and Methods 3 Manual input devices are used by people to enter data by hand. Keyboard Pointing devices Joystick.
Module 3 Productivity Programs Common Features and Commands Microsoft Office 2007.
Visual Basic Chapter 1 Mr. Wangler.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming First Edition.
Microsoft Windows LEARNING HOW USE AN OPERATING SYSTEM 1.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
CompSci 4 Chap 5 Sec 1 Oct 13, 2005 Prof. Susan Rodger Note: thanks to Wanda Dann and Steve Cooper for slide ideas.
Dec 13, 2005 Introduction to 3D Drawing Ipek Gursel Office: A301
Programming with Alice Computing Institute for K-12 Teachers Summer 2011 Workshop.
© 2006 Lawrenceville Press Slide 1 Chapter 3 Visual Basic Interface.
AS Level ICT Selection and use of appropriate software: Interfaces.
Know Your Computer By Jesus Vargas Day 1. Monitor.
XP New Perspectives on Windows XP Tutorial 1 Exploring the Basics.
Today’s Agenda 1.Collect Pre-Lab 5 2.Collect Alice project storyboards 3.Events 4.Dummy Objects 5.Assign pair programming teams and meet upstairs for Lab.
March 5, Quiz Monday on the following:
Output Design. Output design  Output can be: Displayed on a screen/VDU/monitor. Printed on paper as hard copy. Sound.
Interactive Programming Sec 49 Web Design. Objectives The student will: Understand the difference between movie mode and an interactive program Understand.
Introduction to Computer in Technology. Internet Discovery Were going to define several terms that are common in Computers and Technology One way to find.
CSCE 121: Introduction to Program Design and Concepts, Honors Dr. J. Michael Moore Spring 2015 Set 15: GUIs 1.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
Lesson No: 6 Introduction to Windows XP CHBT-01 Basic Micro process & Computer Operation.
XP New Perspectives on Microsoft Office Access 2003 Tutorial 10 1 Microsoft Office Access 2003 Tutorial 10 – Automating Tasks With Macros.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 4: Events Programming with Alice and Java First Edition by John Lewis.
Event Handling Tonga Institute of Higher Education.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Alice: A Visual Introduction to Programming Third Edition.
Microsoft Visual Basic 2005 BASICS Lesson 3 Events and Code.
COMPUTER MAIN PARTS SANTIAGO OCAMPO MEJIA. HARDWARE  Or materials set of physical elements of a computer or a computer system.
Skater World: Part Three By Deborah Nelson Duke University Under the direction of Professor Susan Rodger June 2009.
Interactive Programming Alice. Control of flow Control of flow -- how the sequence of actions in a program is controlled. What action happens first, what.
5 Event Handling Interactive Programming Suggested Reading Interaction: Events and Event Handling, Supplemental Text for CPSC 203 Distributed this term.
Introduction to A+CAD. Objectives Understand fundamental CAD concepts Start A+CAD Tour the A+CAD interface Explore the different A+CAD data input methods.
Procedural programming Procedural programming is where you specify the steps required. You do this by making the program in steps. Procedural programming.
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
UNIT 5: AutoCAD Coordinate Systems
Introduction to Programming and Visual Basic
Starting Out with Alice: A Visual Introduction to Programming
Introduction to Event-Driven Programming
Event-driven programming
The Alice Interface.
An Introduction to Visual Basic
Lesson 1: Buttons and Events – 12/18
Introduction to Events
What is an operating system?
Event Driven Programming
Learning Java with Alice 3.0 Game Design Kathy Bierscheid
Alice terms Chapter 3.
Graphical User Interfaces
Presentation transcript:

Event-driven programming

Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen and a mouse (or other device) to control a pointer that can be used to operate the computer. Event-Driven Programming

An Introduction to Programming Using Alice Most modern computer programs that people use have Graphical User Interfaces (GUIs). A GUI has icons on the computer screen and a mouse (or other device) to control a pointer that can be used to operate the computer.

This slide is an image of Microsoft Word It is an example of a modern graphical user interface.

Modern GUIs like the Word 2007 interface require the use of event-driven programming. An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler.

An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler. Modern operating systems and programming languages contain facilities to let programmers set up event listeners.

An event trigger can be almost any activity or condition selected by the programmer, such as a mouse movement, someone pressing the enter key, or a bank account balance changing.

An event handler is a method that is activated when the event trigger occurs. Almost any method can serve as an event handler, such as those that play sounds, initiate data communications, or perform calculations.

In Alice… Events can be used to control objects moving in 3D space. –Detect when some object moves –Detect when two objects collide –Make objects move in response to mouse or keyboard commands. So before discussing events in Alice, let’s talk about 3D space a little more.

3D space A dimension is a way of measuring something. We create a dimension whenever we assign a value on a continuous scale to some property. Example: On a scale of 1 to 100, how much do you approve of George Bush’s performance as president?

Measuring distance If you wish to measure the location of a point on a straight line, then you only need one number. You could mark a start point on the line, and then measure how far a point is from the start point By using negative and positive numbers, you could also indicate which direction the distance spans.

Orientation In addition, to the concepts of distance and direction, we also have the concept of orientation. Orientation means the direction the object is facing. If an object is facing the positive direction on the line, its orientation is forward. If facing negative, then backward.

Point of view Location and orientation together are known as the point of view of an object.

Two ideas of direction Absolute vs. object-relative. Absolute direction of boy on bike I backward, but forward in relation to Alice

Object-relative positions From the coach’s point of view, Alice is behind the boy, while the coach is in front of the boy.

Position in 2D On a flat surface, like a sheet of paper, you need two values to specify an object’s position (two dimensions). Rene Descarte developed a system of quantification for two dimensions. This is called Cartesian coordinates. Cartesian coordinates have an X axis (dimension) and Y axis. The coordinates of a point are always specified as x,y.

A third dimension Moving up and down off a flat plane requires a third axis or dimension. Instead of an ordered pair to represent position, we need an ordered triplet (x,y,z). In Alice the z axis provides a measurement of depth. 3D space is sometimes called Euclidean 3-space after the Greek mathematician, Euclid.

Absolute vs. Object-relative For all objects we must be aware of absolute position and direction However, we are most commonly concerned with object-relative position and direction.

More on object-relativity We must also frequently consider the movement of objects from the perspective of other objects. See SharkAsSeenByExample.a2w

Events in Alice

Alice events are created in the events area of the standard Alice interface. events area

Events in Alice Alice events are created in the events area of the standard Alice interface. events area

Events in Alice An Alice event tile specifies the event trigger and the event handler. In this example, the event trigger is the spacebar, being pressed and the event handler is the iceSkater’s simpleSpin method.

Events in Alice create new event button The create new event button will reveal a menu with nine different event types.

Events in Alice The create new event button will reveal a menu with nine different event types.

Events in Alice A programmer can pick the event type that has the desired event trigger.

Events in Alice Some event types also have built-in event handlers… A programmer can pick the event type that has the desired event trigger.

Events in Alice Some event types also have built-in event handlers… In other cases, programmers must specify the handler. A programmer can pick the event type that has the desired event trigger.

Event handlers are specified by dragging method tiles from the details area and dropping them into the event tile.

Exploring Events Start Alice and open the amusementPark example world. In the events area, you should see seven event tiles.

Amusement Park Events

Event-Driven Programming Events are an important part of Alice programming, allowing the creation of interactive worlds with keyboard and mouse user controls. Most modern programming languages allow programmers to add events to new software. Events can be used for many other purposes, such as controlling burglar alarms, checking remote sensors, or checking for system events, like printers running out of paper. Events are an important part of modern computer programming.