home *** CD-ROM | disk | FTP | other *** search
/ The Fred Fish Collection 1.5 / ffcollection-1-5-1992-11.iso / ff_disks / 300-399 / ff339.lzh / PCQ / Runtime.lzh / Runtime / Extras / DeadKeyConvert.p < prev    next >
Text File  |  1989-10-21  |  2KB  |  47 lines

  1. External;
  2.  
  3. {
  4.     DeadKeyConvert.p
  5.  
  6.     When you want Intuition to send you keystrokes, you either get just
  7.     the simple key-cap type keys (i.e. no cursor or function keys) or you
  8.     get keycodes, which tell you nothing about what was on the key the
  9.     user pressed.  DeadKeyConvert allows you to receive RAWKEY messages,
  10.     the translate them into their ANSI key sequences.  These are known as
  11.     cooked keys, and a single keystroke might be converted into as many as
  12.     four characters (including the CSI).  See the ROM Kernel Manual and the
  13.     Enhancer manual for details.
  14.     The difference between this and RawKeyConvert is that this also
  15.     handles the deadkeys - for example, pressing ALT-K, releasing it, and
  16.     pressing o gives you an o with an umlaut.
  17.     Also note that some keys will come back with a length of zero - the
  18.     shift and alt keys, for example.  You can probably ignore them.
  19.     Finally, I'll point out that, since this function calls RawKeyConvert,
  20.     you need to call OpenConsoleDevice (defined in ConsoleUtils) before using
  21.     it.
  22. }
  23.  
  24. {$I "Include/ConsoleUtils.i"}
  25. {$I "Include/InputEvent.i"}
  26. {$I "Include/Intuition.i"}
  27.  
  28. Function DeadKeyConvert(msg : IntuiMessagePtr; Buffer : String;
  29.             BufSize : Integer; KeyMap : Address) : Integer;
  30. var
  31.     Event : InputEvent;
  32.     Temp  : ^Address;
  33. begin
  34.     if msg^.Class <> RAWKEY_f then
  35.     DeadKeyConvert := -2;
  36.     with Event do begin
  37.     ieNextEvent := Nil;
  38.     ieClass := IECLASS_RAWKEY;
  39.     ieSubClass := 0;
  40.     ieCode := msg^.Code;
  41.     ieQualifier := msg^.Qualifier;
  42.     Temp := msg^.IAddress;
  43.     ieXYorAddr := Integer(Temp^);
  44.     end;
  45.     DeadKeyConvert := RawKeyConvert(Adr(Event), Buffer, BufSize, KeyMap);
  46. end;
  47.