Unformatted text preview:

1Fall 2005 6.831 UI Design and Implementation 1 Fall 2005 6.831 UI Design and Implementation 2  InputFall 2005 6.831 UI Design and Implementation 3  Console I/O uses blocking procedure callsprint (Enter name: )name = readLine();print (Enter phone number: )name = readLine(); System controls the dialogue GUI input uses event handling instead User has much more control over the dialogue  User can click on almost anythingFall 2005 6.831 UI Design and Implementation 4 Raw input events Mouse moved Mouse button pressed or released Key pressed or released Translated input events Mouse click or double-click Mouse entered or exited component Keyboard focus gained or lost (loss of focus is sometimes called blur ) Character typed2Fall 2005 6.831 UI Design and Implementation 5  Mouse position (X,Y) Mouse button state Modifier key state (Ctrl, Shift, Alt, Meta) Timestamp Why is timestamp important?Fall 2005 6.831 UI Design and Implementation 6! Events are stored in a queue User input tends to be bursty Queue saves application from hard real time constraints (i.e., having to finish handling each event before next one might occur) Mouse moves are coalesced into a single event in queue If application cant keep up, then sketched lines have very few pointsFall 2005 6.831 UI Design and Implementation 7 While application is running Block until an event is ready Get event from queue (sometimes) Translate raw event into higher-level events Generates double-clicks, characters, focus, enter/exit, etc. Translated events are put into the queue Dispatch event to target component Who provides the event loop? High-level GUI toolkits do it internally (Java, VB, C#) Low-level toolkits require application to do it (MS Win, Palm, SWT)Fall 2005 6.831 UI Design and Implementation 8" #  $ Dispatch: choose target component for event Key event: component with keyboard focus Mouse event: component under mouse Mouse capture: any component can grab mouse temporarily so that it receives all mouse events (e.g. for drag & drop) Propagation: if target component declines to handle event, the event passes up to its parent3Fall 2005 6.831 UI Design and Implementation 9%   Events propagate in different directions on different browsers Netscape 4: downwards from root to target Internet Explorer: upwards from target to root W3C standardized by combining them Netscape 6+/Mozilla/Opera/W3C: first downwards (capturing ), then upwards (bubbling )Fall 2005 6.831 UI Design and Implementation 10"$$& A controller is a finite state machine Example: push buttonHoverArmedDisarmedpressIdlemouse entermouse exitexitenterrelease(invoke)releaseFall 2005 6.831 UI Design and Implementation 11  Generic reusable controllers (Garnet and Amulet toolkits) Selection interactor Move/Grow interactor New-point interactor Text editing interactor Rotating interactor Hide the details of handling input events and finite state machines Useful only in a component model Parameterized start, stop, abort events start location, inside/outside predicates feedback components callback procedures on event


View Full Document

MIT 6 831 - LECTURE NOTES

Documents in this Course
Output

Output

15 pages

Quiz 2

Quiz 2

10 pages

Quiz 2

Quiz 2

8 pages

Input

Input

9 pages

Load more
Download LECTURE NOTES
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view LECTURE NOTES and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view LECTURE NOTES 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?