EKEY part 3 of 3 
Author Message
 EKEY part 3 of 3


EKEY Implementor's Notes                        Part 3 of 3

The disadvantages of the simpler version are:

        a) An application program that uses KEY , expecting to
           receive only valid characters, might receive a sequence of
           bytes (e.g.  a zero byte followed by a byte with the same
           numerical value as the letter 'A') that appears to contain
           a valid character, even thought the user pressed a key
           (e.g.  function key 4) that does not correspond to any
           valid character.

        b) An application program that wishes to handle
           non-character events will have to execute KEY twice if it
           returns zero the first time.  This might appear to be a
           reasonable and easy thing to do.  However, such code is
           not portable to other systems that do not use a zero byte
           as an "escape" code.  Using the EKEY approach, the
           algorithm for handling keyboard events can be the same
           for all systems; the system dependencies can be reduced
           to a table or set of constants listing the
           system-dependent key codes used to access particular
           application functions.  Without EKEY, the algorithm, not
           just the table, is likely to be system-dependent.

                        EKEY on mouse-based systems

In systems that combine both keyboard and mouse events into a single
"event stream", the single number returned by EKEY may be inadequate
to represent the full range of input possibilities.  In such
systems, a single "event record" may include a timestamp, the x,y
coordinates of the mouse position, the keyboard state, and the state
of the mouse buttons.

In such systems, it might be appropriate for EKEY to return the
character value for simple keyboard character events, or the address
of an "event record" for mouse events.  Intermediate encodings might
also be useful, such as returning non-character numerical values for
keyboard events such as function keys.



Fri, 07 Jan 1994 21:58:38 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. EKEY part 2 of 3

2. EKEY part 1 of 3

3. KEY , EKEY , AND EKEY>CHAR

4. IDLE-EKEY?

5. EKEY in gforth in DOS

6. EKEY in gforth for linux?

7. KEY and EKEY

8. EKEY>CHAR in Win32Forth

9. portable definitions for KEY and EKEY?

10. EKEY and double numbers

11. KEY and EKEY

12. Key and EKey

 

 
Powered by phpBB® Forum Software