[comp.sys.mac.hypercard] SUMMARY: InKey XCMD

Andrew Nielsen (01/29/91)

Thanks to the many people who responded to my request for information about the
InKey XCMD.  This XCMD intercepts keyDown events and reports which key was
pressed.  It is probably only useful for people using HyperCard v1.*, as the
HyperCard 2.0 has a keyDown message which provides the same functionality.

However, for those who are interested, here is a brief summary of some
responses I received:

----------------------------------------------------------------------
From: Keith Conover <IRELAND@ac.dal.ca>

I wrote a HC 1.2 stack which required detecting specific keystrokes and found
the InKey XCMD to be unusable. Among other things it missed many keystrokes.
I used a different XCMD, written by Nigel Perry (SetKeys?, can't remember the
exact name) which worked fine. But keytrapping is now an integral part of
HC 2.0. The keydown message is described on page 936 of "HyperTalk 2.0 The
Book" by Winkler and Kamins. The example script they give in case you don't
have this book is as follows.

on keydown whatkey
   put whatkey && charToNum(whatkey)
end keyDown
----------------------------------------------------------------------
From: Heinrich Arn <arn@faw.ethz.ch>

I saw your posting on INKEY XFCN
I found it in Steve Drazga's Developer Stack v 1.2. I have not tried
it in HC 2.0 because I want to read a manual before converting my
cherished stacks. I try to send you a binhexed version in the following
letter.

The comments in the Developer Stack are as follows:
InKey is a XFCN that allows you to trap for any key typed.


If you find this XFCN useful, feel free to use and distribute.

      Guy de Picciotto.

CIS: 73300,3637
GENIE: G.PICCIOTO

Syntax:

Inkey()

To capture all keystrokes, use the following script in your stack
script:

On Idle
    get Inkey()
    pass idle
End Idle
----------------------------------------------------------------------
From: Nigel Perry <np@doc.ic.ac.uk>

Andrew,
	Look on sumex for either the stack MacInTalk or SetKeyboard -
these both contain ControlLock/SetKeyboard (latter is newer) which
provide event driven keyboard input under HC 1 (InKey is not event
driven, you have to call it). If you have problems finding it I can
dig out the latest version of SetKeyboard for you.  XCMD is copyright,
free for non-commercial use etc.

Hope this helps, cheers

Nigel (author)
----------------------------------------------------------------------
From: Jonathan King <jk3t+@andrew.cmu.edu>

Yes, there did used to be an X-thing called InKey (after a fondly
remembered Applesoft Basic command) that returned keystrokes.  The
only place I remember seeing it was in one of the large Hypercard
xcmd/icon/sound/everything-else collections, maybe the one known as
"Stack Starter".

What might be easier, and better in the long run, is to get HC 2.0,
since it includes this functionality.  I don't know what the situation
is in Australia about HC 2.0 availability, but somebody over there
should know.

Good luck,

jking
----------------------------------------------------------------------