/*
  keyin.sim                                         V0.1 (Cim 3.29 / Win32)  

  This is test prgram for the inchar,
  it input events and writes all parameters of pressed key or mouse event.
  You can exit by pressing space-key
*/

external class terminal;
terminal begin

        open(25,80);
        outline ("Press <h> to hide mouse.");
        outline ("Press <s> to show mouse.");
        outline ("Press <c> to show clear screen.");
        outline ("Press <space> or <ctr>+c to exit...");
%        listenControllKeys (true);  /* enable this line to see controlls   */
%        listenReleaseKeys (true);   /* enable this line to see key release */
        setMouse (true);
        while inchar <> ' ' do begin
            if (lastKey.map = 'h') then setMouse (false);  /* hide */
            if (lastKey.map = 's') then setMouse (true);   /* show */
            if (lastKey.map = 'c') then erasePage;         /* cls */
            outtext("map: "); outint(rank(lastkey.map),3);
            outtext("  chr: "); outint(rank(lastkey.chr),3);
            outtext("  fkey: "); outint(lastkey.fkey,4);
            outtext("  c0: "); outint(rank(lastkey.c0),3);
            outtext("  c1: "); outint(rank(lastkey.c1),3);
            outtext("  c2: "); outint(rank(lastkey.c2),3);
            outtext("  x y: "); outint((lastkey.x),3);
                                outint((lastkey.y),3);
            outimage;
        end;
        close;
end;
