Professor John Canny Spring 2004 March 3

Slides:



Advertisements
Similar presentations
Interaction Design: Visio
Advertisements

Chapter 16 Graphical User Interfaces John Keyser’s Modifications of Slides by Bjarne Stroustrup
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
The Web Warrior Guide to Web Design Technologies
Server-Side vs. Client-Side Scripting Languages
CS 160: UI Implementation Professor John Canny 4/16/2017.
6/13/20151 CS 160: Lecture 13 Professor John Canny Fall 2004.
Event Models James Landay, UCB Outline Event overview Event overview Windowing systems Windowing systems Window events Window events Event dispatching.
Active X Microsoft’s Answer to Dynamic Content Reference: Using Active X by Brian Farrar QUE
Interaction Models I Marti Hearst (UCB SIMS) SIMS 213, UI Design & Development March 9, 1999.
Stanford hci group / cs376 research topics in human-computer interaction UI Software Tools Scott Klemmer 27 October 2005.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
© 2011 Delmar, Cengage Learning Chapter 11 Adding Media and Interactivity with Flash and Spry.
DHTML - Introduction Introduction to DHTML, the DOM, JS review.
AJAX Chat Analysis and Design Rui Zhao CS SPG UCCS.
20-753: Fundamentals of Web Programming Copyright © 1999, Carnegie Mellon. All Rights Reserved. 1 Lecture 16: Java Applets & AWT Fundamentals of Web Programming.
Programming with Microsoft Visual Basic 2012 Chapter 12: Web Applications.
Chapter 34 Java Technology for Active Web Documents methods used to provide continuous Web updates to browser – Server push – Active documents.
Chapter 8 Browsing and Searching the Web. Browsing and Searching the Web FAQs: – What’s a Web page? – What’s a URL? – How does a browser work? – How do.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Lecture Note 1: Getting Started With ASP.  Introduction to ASP  Introduction to ASP An ASP file can contain text, HTML tags and scripts. Scripts in.
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Cs332a_chapt10.ppt CS332A Advanced HTML Programming DHTML Dynamic Hypertext Markup Language A term describing a series of technologies Not a stand-a-lone.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
8 Chapter Eight Server-side Scripts. 8 Chapter Objectives Create dynamic Web pages that retrieve and display database data using Active Server Pages Process.
1 Lecture 5: Interactive Tools: Prototypers (HyperCard, Director, Visual Basic), Interface Builders Brad Myers Advanced User Interface Software.
ASP. ASP is a powerful tool for making dynamic and interactive Web pages An ASP file can contain text, HTML tags and scripts. Scripts in an ASP file are.
1) PHP – Personal Home Page Scripting Language 2) JavaScript.
Web Programming Overview. Introduction HTML is limited - it cannot manipulate data How Web pages are extended (include): –Java: an object-oriented programming.
Understanding JavaScript and Coding Essentials Lesson 8.
Web Technology (NCS-504) Prepared By Mr. Abhishek Kesharwani Assistant Professor,UCER Naini,Allahabad.
1 CSC160 Chapter 1: Introduction to JavaScript Chapter 2: Placing JavaScript in an HTML File.
Systems and User Interface Software. Types of Operating System  Single User  Multi User  Multi-tasking  Batch Processing  Interactive  Real Time.
Embedded Real-Time Systems Processing interrupts Lecturer Department University.
Chapter 1 Getting Started with ASP.NET Objectives Why ASP? To get familiar with our IDE (Integrated Development Environment ), Visual Studio. Understand.
WORKING OF SCHEDULER IN OS
Introduction to threads
Running a Forms Developer Application
Processes and threads.
WWW and HTTP King Fahd University of Petroleum & Minerals
Chapter 3: Process Concept
FOP: Buttons and Events
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Lecture: Protocols in Detail
Day 12 Threads.
Process Management Presented By Aditya Gupta Assistant Professor
AJAX.
AJAX.
PHP / MySQL Introduction
Lesson 1: Buttons and Events – 12/18
Chap 7. Building Java Graphical User Interfaces
Introduction to Silverlight
Chapter 4: Threads.
Database Driven Websites
Professor John Canny Fall 2004
Creating Windows Store Apps Using Visual Basic
Threads and Data Sharing
Chapter 2 – Introduction to the Visual Studio .NET IDE
Tutorial 6 Creating Dynamic Pages
Teaching slides Chapter 6.
Professor John Canny Spring 2003 March 10
Professor John Canny Spring 2004 March 5
Introduction to DHTML, the DOM, JS review
January 15, 2004 Adrienne Noble
CSE 153 Design of Operating Systems Winter 2019
Professor John Canny Spring 2003 March 12
Chapter 4: Threads.
Message Passing Systems Version 2
An Introduction to the Windows Operating System
Message Passing Systems
Presentation transcript:

Professor John Canny Spring 2004 March 3 CS 160: Lecture 11 Professor John Canny Spring 2004 March 3 12/5/2018

Outline Finish windows and events Platforms: PC (Viz Basic, Java) Web (HTML, Javascript) Windows CE BREW SVG 12/5/2018

Event-Driven Programming All generated events go to a single event queue provided by operating system ensures that events are handled in the order they occurred hides specifics of input from apps Mouse Software Event Queue Keyboard Software 12/5/2018

Widgets Reusable interactive objects Handle certain events widgets say what events they are interested in event queue/interactor tree sends events to the “right” widget Update appearance e.g. button up / button down Describe the widgets on the side, button, combo box, checkbox, etc ComboBox Button 12/5/2018

Widgets (cont.) Generate some new events “button pressed” “window closing” “text changed” But these events are sent to interested listeners instead custom code goes there ComboBox 12/5/2018

Main Event Loop Source Code while (app is running) { get next event send event to right widget } Mouse Software Events Source Code Keyboard Software 12/5/2018

Callbacks Callbacks: every widget registers itself to receive certain events with the OS. Dangers: UI code using callbacks is usually single-threaded. Control does not return to the event loop until the callback returns. Therefore in a callback routine, never: Wait for another event. Sleep. Perform I/O or other actions that may block. 12/5/2018

Threaded code Multi-threaded code uses distinct threads for distinct widgets. It allows blocking operations (e.g. I/O) to be confined to particular threads that don’t affect interactivity. If your program has any time-intensive parts, they should run in different threads from the UI code. 12/5/2018

Threaded code Use separate threads for any operations that can occur asynchronously: UI interactions. File operations – use separate threads if you need to be updating several files at the same time. Inter-process communication (sockets): use one thread for each connection. Use a thread for each other I/O device, e.g. one each for reading from or writing to the sound card. 12/5/2018

Inter-thread communication The window system and running process in the OS communicate using message passing: The event queue and sockets are examples of message-passing primitives. Processes in the same address space (i.e. within your program) can use shared memory (i.e. shared variables) which is much more efficient. 12/5/2018

Flag to show this thread is writing new data Synchronization Shared-memory communication poses challenges. If you rely on “mailbox” primitives, things can go wrong: <blank> Flag to show this thread is writing new data Data 12/5/2018

Flag to show this thread is writing new data Synchronization <blank> Flag to show this thread is writing new data Data Intuitively, threads that want to write should: …. wait until thread_id = 0; write thread_id; write data; 12/5/2018

Flag to show this thread is writing new data Synchronization <blank> Flag to show this thread is writing new data Data But thread switching can happen anytime, e.g. …. wait until thread_id = 0; write thread_id; write data; 12/5/2018

Flag to show this thread is writing new data Synchronization <blank> Flag to show this thread is writing new data Data A switch between checking the flag and setting it allows both threads to (incorrectly) write the flag and their data. To prevent this, we define critical sections of the code that cannot be interrupted. 12/5/2018

Synchronization e.g. the critical section in the example is: …. <blank> Flag to show this thread is writing new data Data e.g. the critical section in the example is: …. wait until thread_id = 0; write thread_id; write data; Critical section, thread can’t be pre-empted. 12/5/2018

Semaphores Rather than many critical sections in your code, you can use a single semaphore primitive. A semaphore is initialized to an integer n, and has just two operations: test(); wait until semaphore > 0, then decrement it. increment(); increment the semaphore. 12/5/2018

Semaphore example Then the example code becomes (with sem1 initialized to 1): …. sem1.test(); write thread_id; write data; sem1.increment(); This section cannot be pre-empted by the other process that is using this semaphore. 12/5/2018

Break 12/5/2018

Interactor Tree Decompose interactive objects into a tree interactive objects also known as “widgets” based on screen geometry of objects nested rectangles Used for dispatching events events are dispatched (sent) to code in widget the code then handles the event Variety of methods for dispatching events return to this later 12/5/2018

Interactor Tree 1 Display Screen “F:\cs160\Public” window Inner Window title bar horizontal scroll bar contents area “CDJukebox” folder “Home Ent…” folder … size control “Web Newspaper” window 12/5/2018

Interactor Tree 2 Display Screen Outer Win [black] Inner Win [green] 7 8 9 4 5 6 + - 1 2 3 = 93.54 ENT Inner Win [green] Result Win [tan] Result String Keypad [Teal] = button - button + button 0 button 12/5/2018

Who gets the events? To catch events, a widget registers a “listener” for that event Mouse click typed input drag… Events go to a widget containing the pointer 7 8 9 4 5 6 + - 1 2 3 = 93.54 ENT 12/5/2018

Who gets the events? But there are often several widgets containing the pointer Events go down the “stack” of visible widgets at the pointer until there is an active widget that has registered a listener for that event 7 8 9 4 5 6 + - 1 2 3 = 93.54 ENT 12/5/2018

Interactor Tree (Java) Display Screen Frame [black] Panel [green] Mouse click listener Text Entry [tan] 7 8 9 4 5 6 + - 1 2 3 = 93.54 ENT Result String Keypad Panel [Teal] Button(“=”) Mouse click listener Button(“-”) Mouse click listener Button(“+”) Mouse click listener Button(“0”) Mouse click listener 12/5/2018

Platforms - PC For regular PC development, the options are: C++/VBasic (Visual Studio) Java Flash SVG Rapid prototyping: Suede, Silk, Satin (see guir.berkeley.edu/projects) 12/5/2018

Platforms - Web For web development one of the main issues is portability. Before designing your app, think about browsers for your user group. There is a lot more than IE and Netscape: Mozilla/Opera AOL: huge community, many versions with limited browsers Old versions of IE and Netscape 12/5/2018

Web standards Unfortunately, HTTP is a non-standard. The current version is HTML 4 (1997), but no browsers fully support it. Microsoft seems to have given up on HTML 4 in 1998. Reasonable support for HTML 4 in Netscape 7 and Mozilla. (but tables are different in most browsers) 12/5/2018

Web standards For portability, its best to stay with HTML 3.2 Javascript is the most portable script. But you’ll probably still need browser-specific code (e.g. CS160 lecture page). 12/5/2018

PDAs Two options for native development– MS Embedded Visual Tools 3.0 (VB and C++) – includes emulators for all platforms (download). MS Visual Studio .NET (huge!) includes tools for XML exchange. – Ask william@eecs for CDs Java: Chai VM for HP Jornadas etc. Usually well behind PC Java – no Jini support Flash: Interesting choice for small devices, better use of limited screen space, but check functionality (esp. script execution). 12/5/2018

Cell phones - BREW BREW is Qualcomm’s “Binary Runtime Environment for Wireless” Something like the WIN32 API, but smaller. BREW 2.0 includes support for GPS-one – though no providers yet Can get GPS info through serial port on emulator PC. 12/5/2018

New standards - XML Fortunately, the situation looks better in future. XML is going to become the standard for web info exchange. XML provides data exchange, and complementary standards control formatting – XSL and XHTML. Good support in Mozilla, also IE and Netscape. 12/5/2018

XML Graphics standards There are two standards for 2D graphics: VML (old) promoted by microsoft – static 2D graphics, available in MS IE now. (example) SVG (new) dynamic 2D graphics, the latest W3C standard. No browser support natively, but plug-in available (Adobe), and custom builds of Mozilla support it. 12/5/2018

SVG SVG is already a big part of mobile UI development: the W3C requires it for multi-media messaging (MMS) on phones in their latest standard. SVG doesn’t have “widgets” per se, but its easy to write them in SVG. Very good for thin clients, or for DENIM-style interactive prototypes. 12/5/2018

SVG Widgets See http://www.mycgiserver.com/~amri/widget.cocoon.xml for the kinds of widgets you can build or use. Many functions in SVG are directly available using the “set” attribute. Others are available via Javascript. 12/5/2018

SVG Authoring Limited set of tools: Authoring static SVG is possible with many tools, especially Adobe Illustrator. Check your favorite tool for a “save as” SVG option. For dynamic SVG, Webdraw is available as a free, limited-time trial, and supports animation. The best tool is XStudio, which has a limited-function trial. 12/5/2018