Textbook Notes (368,544)
United States (206,068)
Chapter 6

Chapter 6 Alice In Action Notes – Events.docx

2 Pages
Unlock Document

Computer Science
CAS CS 101
Aaron Stevens

Chapter 6 Alice In Action Notes – Events There are 2 steps to making a program respond when an event occurs: 1. Choose (or define) a method providing the behavior to occur in response to the event 2. Tell Alice to invoke that method whenever the event occurs handling the event - Invoking a method in response to an event event handler - a method that is invoked in response to an event is often called an event handler event-driven program - A program that solves a problem or tells a story mainly through events and handlers • If an event should trigger behavior that requires more than one message, we define a method that produces that behavior. (this method is the handler) ◦ create a new event in the events area that invokes the handler - either the method we defined or a single message will produce the proper behavior for the event event source - object from which an event originates logic errors - the mistakes in the logic used in defining an event • Event handling is simultaneous - one thing could happen before another thing finishes ◦ usually works well, but if they are modifying the same property of an object conflicts can rise mouse event - event that is triggered when the user moves the mouse or clicks a mouse button keyboard event - is triggered when the user presses a keyboard key user events - events initiated by a user action program event - triggered when the world starts running, or the program changes the value of a variable or condition Mnemonic Values - ‘a’ is the first letter of ‘ascend’ and ‘d’ is the first letter of ‘descend’, these are easy to remember | the arrows point in the direction the object would go Convenient Positions - ‘a’ and ‘d’ are near one another on most keyboards = easy to control, the 4 arrow keys are grouped together • important to consider human factors when building interactive stories Usability - making programs easy to use Using “when a key is pressed/typed event”: • contains three different handlers: 1. Begin - a handler here is performed once, when the key is first pressed 2. During - a handler here is performed continuously, as long as the key remains down 3. End - a handler here is performed once, when t
More Less

Related notes for CAS CS 101

Log In


Join OneClass

Access over 10 million pages of study
documents for 1.3 million courses.

Sign up

Join to view


By registering, I agree to the Terms and Privacy Policies
Already have an account?
Just a few more details

So we can recommend you notes for your school.

Reset Password

Please enter below the email address you registered with and we will send you a link to reset your password.

Add your courses

Get notes from the top students in your class.