input
play

Input - PDF document

Input Fall 2005 6.831 UI Design and Implementation 1 Fall 2005 6.831 UI Design and Implementation 2


  1. �������������� � Input ����������������������� Fall 2005 6.831 UI Design and Implementation 1 Fall 2005 6.831 UI Design and Implementation 2 ����������������������������� ��������������������� � Console I/O uses blocking procedure calls � Raw input events print ( � Enter name: � ) � Mouse moved name = readLine(); � Mouse button pressed or released print ( � Enter phone number: � ) � Key pressed or released name = readLine(); � Translated input events � System controls the dialogue � Mouse click or double-click � GUI input uses event handling instead � Mouse entered or exited component � User has much more control over the dialogue � Keyboard focus gained or lost (loss of focus is � User can click on almost anything sometimes called � blur � ) � Character typed Fall 2005 6.831 UI Design and Implementation 3 Fall 2005 6.831 UI Design and Implementation 4 1

  2. ��������������������������� ������!���� � Events are stored in a queue � Mouse position (X,Y) � User input tends to be bursty � Mouse button state � Queue saves application from hard real � Modifier key state (Ctrl, Shift, Alt, Meta) time constraints (i.e., having to finish � Timestamp handling each event before next one might occur) � Why is timestamp important? � Mouse moves are coalesced into a single event in queue � If application can � t keep up, then sketched lines have very few points Fall 2005 6.831 UI Design and Implementation 5 Fall 2005 6.831 UI Design and Implementation 6 ���������� ������"��������#� ����$����� � Dispatch: choose target component for � While application is running � Block until an event is ready event � Get event from queue � Key event: component with keyboard focus � (sometimes) Translate raw event into higher-level events � Generates double-clicks, characters, focus, enter/exit, etc. � Mouse event: component under mouse � Translated events are put into the queue � Mouse capture : any component can grab � Dispatch event to target component mouse temporarily so that it receives all mouse � Who provides the event loop? events (e.g. for drag & drop) � High-level GUI toolkits do it internally (Java, VB, C#) � Propagation: if target component � Low-level toolkits require application to do it (MS Win, Palm, SWT) declines to handle event, the event passes up to its parent Fall 2005 6.831 UI Design and Implementation 7 Fall 2005 6.831 UI Design and Implementation 8 2

  3. %��������� ������������ "���$���$���&��������� � Events propagate in different directions � A controller is a finite state machine on different browsers � Example: push button � Netscape 4: downwards from root to target � Internet Explorer: upwards from target to Armed press root mouse enter � W3C standardized by combining them release exit Idle Hover enter � Netscape 6+/Mozilla/Opera/W3C: first (invoke) mouse exit downwards ( � capturing � ), then upwards ( � bubbling � ) Disarmed release Fall 2005 6.831 UI Design and Implementation 9 Fall 2005 6.831 UI Design and Implementation 10 ����������� � 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 transitions Fall 2005 6.831 UI Design and Implementation 11 3

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend