home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 5 Edit / 05-Edit.zip / epmsmp.zip / DEADKEYS.E < prev    next >
Text File  |  1992-08-26  |  1KB  |  54 lines

  1. ; Sample code to define your own "dead" keys.  This example
  2. ; uses ctrl+' as the dead key, which is not a definable
  3. ; key, so I added it as an accelerator key.
  4. ; If you used a different key (defined in MYKEYS.E or MYSTUFF.E), you
  5. ; might not have to define it as an accelerator.
  6. ;                   Larry Margolis
  7.  
  8. include 'stdconst.e'
  9.  
  10. definit
  11.    universal activeaccel
  12.    buildacceltable activeaccel, 'accelkeys', AF_CHAR+AF_CONTROL, 39, 1102  -- c+'
  13.    activateacceltable activeaccel
  14.  
  15. defc accelkeys
  16.    universal ACCEL_STARTING_KEYSET
  17.    if .keyset = 'ACCEL_KEYS' then
  18.       call end_accelkeys()
  19.       return
  20.    endif
  21.    ACCEL_starting_keyset = upcase(.keyset)
  22.    keys accel_keys
  23.    sayerror 'Press key to be accented.'
  24.  
  25. defproc end_accelkeys
  26.    universal ACCEL_STARTING_KEYSET
  27.    .keyset = ACCEL_STARTING_KEYSET
  28.    sayerror 0
  29.  
  30. defkeys accel_keys new clear
  31.  
  32. def 'a' = keyin 'É'; call end_accelkeys()
  33.  
  34. def 'A' = keyin '▌'; call end_accelkeys()
  35.  
  36. def 'e' = keyin '⌐'; call end_accelkeys()
  37.  
  38. def 'E' = keyin 'ê'; call end_accelkeys()
  39.  
  40. def 'n' = keyin 'ï'; call end_accelkeys()
  41.  
  42. def 'N' = keyin '¼'; call end_accelkeys()
  43.  
  44. def otherkeys =
  45.    k = lastkey()
  46.    if k=\10\18 | k=\09\10 | k=\11\34 | k=\0 then   -- Ctrl, Shift, Alt, or null:
  47.       return                                       --   ignore
  48.    endif
  49.    call end_accelkeys()
  50. compile if 1     -- Optionally execute the key that ended the accel_keys keyset.
  51.    executekey k
  52. compile endif
  53.  
  54.