Ch 3 event driven programming

4,102 views

Published on

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
4,102
On SlideShare
0
From Embeds
0
Number of Embeds
3
Actions
Shares
0
Downloads
57
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • The Events area shows existing events and is used to create new events. An event consists of a condition, called an event trigger , and the name of a method, called an event handler . Whenever the event trigger occurs, the event handler is called into action. For example, you might want the sound of a splash to occur if an ice skater falls through the ice. Some events, such as causing a method to run when a key is pressed, provide user interaction for an Alice world. Events are covered in detail in Chapter 3.
  • Ch 3 event driven programming

    1. 1. Event-Driven Programming
    2. 2. 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 . An Introduction to Programming Using Alice
    3. 3. 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 . An Introduction to Programming Using Alice
    4. 4. 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 .
    5. 5. An Introduction to Programming Using Alice
    6. 6. <ul><li>This slide is an image of Microsoft Word 2007. It is an example of a modern graphical user interface. </li></ul>
    7. 7. <ul><li>Modern GUIs like the Word 2007 interface require the use of event-driven programming. </li></ul><ul><li>An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler . </li></ul>
    8. 8. <ul><li>An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler . </li></ul>
    9. 9. <ul><li>An event occurs whenever an event listener detects an event trigger and responds by running a method called an event handler . </li></ul><ul><li>Modern operating systems and programming languages contain facilities to let programmers set up event listeners. </li></ul>
    10. 10. <ul><li>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. </li></ul>
    11. 11. <ul><li>An event handler is a method that is activated when the event trigger occurs. </li></ul><ul><li>Almost any method can serve as an event handler, such as those that play sounds, initiate data communications, or perform calculations. </li></ul>
    12. 12. Events in Alice <ul><li>Alice events are created in the events area of the standard Alice interface. </li></ul>events area
    13. 13. Events in Alice <ul><li>Alice events are created in the events area of the standard Alice interface. </li></ul>events area
    14. 14. Events in Alice <ul><li>An Alice event tile specifies the event trigger and the event handler. </li></ul><ul><li>In this example, the event trigger is the spacebar, being pressed and the event handler is the iceSkater’s simpleSpin method. </li></ul>
    15. 15. Events in Alice <ul><li>The create new event button will reveal a menu with nine different event types. </li></ul>create new event button
    16. 16. Events in Alice <ul><li>The create new event button will reveal a menu with nine different event types. </li></ul>
    17. 17. Events in Alice <ul><li>A programmer can pick the event type that has the desired event trigger. </li></ul>
    18. 18. Events in Alice <ul><li>A programmer can pick the event type that has the desired event trigger. </li></ul>Some event types also have built-in event handlers…
    19. 19. Events in Alice <ul><li>A programmer can pick the event type that has the desired event trigger. </li></ul>Some event types also have built-in event handlers… In other cases, programmers must specify the handler.
    20. 20. Event handlers are specified by dragging method tiles from the details area and dropping them into the event tile.
    21. 21. Event-Drive Programming <ul><li>Events are an important part of Alice programming, allowing the creation of interactive worlds with keyboard and mouse user controls. </li></ul><ul><li>Most modern programming languages allow programmers to add events to new software. </li></ul><ul><li>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. </li></ul><ul><li>Events are an important part of modern computer programming. </li></ul>

    ×