home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 24 / CD_ASCQ_24_0995.iso / dos / tools / aurora21 / keycodes.aml < prev    next >
Text File  |  1995-08-10  |  3KB  |  82 lines

  1. /* ------------------------------------------------------------------ */
  2. /* Macro:        KEYCODES.AML                                         */
  3. /* Written by:   nuText Systems                                       */
  4. /*                                                                    */
  5. /* Description:  This macro displays various keycodes for each key    */
  6. /*               pressed.                                             */
  7. /*                                                                    */
  8. /* Usage:        Select this macro from the Macro List (on the Macro  */
  9. /*               menu), or run it from the macro picklist <shift f12> */
  10. /* ------------------------------------------------------------------ */
  11.  
  12.   include bootpath "define.aml"
  13.  
  14.   // keep this object resident
  15.   stayresident
  16.   inheritfrom "win"
  17.  
  18.   // create main window with titles
  19.   createwindow
  20.   setframe ">b"
  21.   setcolor  border_color         color white on gray
  22.   setcolor  border_flash_color   color brightgreen on gray
  23.   setcolor  text_color           color brightgreen on gray
  24.   settitle "Display Keycodes - press <esc> twice to exit"
  25.   setwinctrl '≡'
  26.   sizewindow 6 5 72 20 "ad"
  27.   setborder "1i"
  28.   setshadow 2 1
  29.   writeline " Keycode  Hexcode  Scancode  Ascii  Hex  Char  Keyname"
  30.  
  31.   // create scrollable subwindow
  32.   createwindow
  33.   sizewindow 0 1 0 0 "rw1" '' (getprevwin)
  34.   setparent (getprevwin)
  35.   setcolor  text_color     color black on gray
  36.   showcursor 80 90
  37.  
  38.   inheritkeys OFF
  39.  
  40.   lastcode = 0
  41.  
  42.   function close
  43.     // call 'close' in object 'win'
  44.     pass
  45.     destroyobject
  46.   end
  47.  
  48.   function "≡"
  49.     close
  50.   end
  51.  
  52.   // don't process shift keys
  53.   key <shiftkey>
  54.  
  55.   key <otherkey> (keycode)
  56.     asciicode = keycode & 0ffh        // get ascii code from keycode
  57.     keyname = getkeyname keycode      // get keyname from keycode
  58.     if lastcode then
  59.       writeline
  60.     end
  61.  
  62.     writestr
  63.       (pad keycode 8) +               // display keycode
  64.       (pad (base keycode 16) 9) +     // display hexcode
  65.       (pad (keycode shr 8) 10) +      // display scancode
  66.       (pad asciicode 7) +             // display asciicode (if any)
  67.       (pad (base asciicode 16) 5) +   // display asciicode (if any)
  68.       (pad (char asciicode) 6) +      // display key char (if any)
  69.       "  " + keyname                  // display keyname
  70.  
  71.     lastcode = keycode                // save last keycode
  72.   end
  73.  
  74.   key <esc> (keycode)
  75.     if lastcode == keycode then
  76.       call close
  77.     else
  78.       call <otherkey> (keycode)
  79.     end
  80.   end
  81.  
  82.