[comp.sys.mac.programmer] page up and friends

dorner@pequod.cso.uiuc.edu (Steve Dorner) (02/07/90)

I'd like to be a good boy and allow use of the F1-F4, page up, page down, help, and other "special" keys.  Am I correct in thinking that I have to:

1. Use SysEnvirons to test for the keyboard in use.
2. Use specific virtual key codes for that keyboard.

It would be nice to hear that there are magic character codes for these keys, so I could avoid this hardware-dependent stuff.  But if that's the case, I can't find it in IM or the tech notes.

Thanks.

--
Steve Dorner, U of Illinois Computing Services Office
Internet: s-dorner@uiuc.edu  UUCP: {convex,uunet}!uiucuxc!dorner

amanda@mermaid.intercon.com (Amanda Walker) (02/10/90)

In article <1990Feb6.205957.27722@ux1.cso.uiuc.edu>, dorner@pequod.cso.uiuc.edu
(Steve Dorner) writes:
> It would be nice to hear that there are magic character codes for these keys,

What you have to do is look at the "keyCode" part of the event message
instead of the "charCode" part.  The function & editing cluster keys
don't have unique ASCII codes, but they do have unique (and standardized)
virtual key codes.  IM V has a chart of (for example) the ADB Extended
keyboard that shows all of the virtual key codes for the function keys
etc.

Hope this helps,
--
Amanda Walker
InterCon Systems Corporation

"Many of the truths we cling to depend greatly upon our own point of view."
	--Obi-Wan Kenobi in "Return of the Jedi"

tecot@Apple.COM (Ed Tecot) (02/21/90)

In article <1990Feb9.163118.5726@intercon.com> amanda@mermaid.intercon.com (Amanda Walker) writes:
>In article <1990Feb6.205957.27722@ux1.cso.uiuc.edu>, dorner@pequod.cso.uiuc.edu
>(Steve Dorner) writes:
>> It would be nice to hear that there are magic character codes for these keys,
>
>What you have to do is look at the "keyCode" part of the event message
>instead of the "charCode" part.  The function & editing cluster keys
>don't have unique ASCII codes, but they do have unique (and standardized)
>virtual key codes.  IM V has a chart of (for example) the ADB Extended
>keyboard that shows all of the virtual key codes for the function keys
>etc.

Actually, this is half right...
The function keys all share the same charCode, but the six keys above the
arrows all have their own "magic" charCodes.  They were chosen to make sense
in the ASCII realm of things (delete is $7F).  I'm actually surprised to
see that it is not documented in Inside Macintosh, but the codes can be
determined empirically (they won't change).  Of course, some of these
charCodes can also be generated with the control key pressed, so using the
virtual key codes might not be so bad after all.

						_emt

aoki@husc8.HARVARD.EDU (Edwin Aoki) (02/22/90)

While we're on the subject of weird keys and their keycodes, does anyone
know how to test for the Reset (triangle) key on the ADB keyboards?

IM V lists it as 7F7F, but I don't know how to check for dual key keycodes
in the result field.

Thanks in advance for your help (please e-mail responses if possible)

-Edwin Aoki
(aoki@husc8.harvard.edu)

rob@cs.mu.oz.au (Robert Wallen) (02/22/90)

In article <38830@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:

>Organization: Apple Computer Inc, Cupertino, CA

>in the ASCII realm of things (delete is $7F).  I'm actually surprised to
>see that it is not documented in Inside Macintosh, but the codes can be
>determined empirically (they won't change).  Of course, some of these
                         ^^^^^^^^^^^^^^^^^
Promise?   With an organization like that, people might try to hold
you to it ... 8-)

chaffee@reed.UUCP (Alex Chaffee) (02/23/90)

In article <38830@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:

	in the ASCII realm of things (delete is $7F).  I'm actually
	surprised to see that it is not documented in Inside Macintosh, but
	the codes can be determined empirically (they won't change).

And here they are, the Empirically Determined Char Codes:

PageUp	0x0B	(VT)
PageDwn	0x0C	(FF)
Home	0x01	(SOH)
End	0x04	(EOT)
FwdDel	0x7F	(DEL)

Sorry, I didn't bother with Help.  Does anyone know what VT and SOH are
supposed to stand for?
-- 
Alex Chaffee
chaffee@reed.UUCP
Reed College, Portland OR 97202
____________________

russotto@eng.umd.edu (Matthew T. Russotto) (02/24/90)

In article <14233@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes:

>And here they are, the Empirically Determined Char Codes:
>
>PageUp	0x0B	(VT)
>Home	0x01	(SOH)
>
>Sorry, I didn't bother with Help.  Does anyone know what VT and SOH are
>supposed to stand for?
VT == Vertical Tab
SOH == Start of Header
--
Matthew T. Russotto	russotto@eng.umd.edu	russotto@wam.umd.edu
][, ][+, ///, ///+, //e, //c, IIGS, //c+ --- Any questions?

athos@apple.com (Rick Eames) (02/24/90)

In article <14233@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes:
>  Does anyone know what VT and SOH are
> supposed to stand for?


I know that VT is 'vertical tab'.  As for SOH, I have no idea.


#############################
Rick Eames

Not Apple's opinions.....blah.....blah.......blah

pwp@shamash.cdc.com (Peter Poorman) (02/24/90)

In article <6870@internal.Apple.COM> athos@apple.com (Rick Eames) writes:
>In article <14233@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes:
>>  Does anyone know what VT and SOH are
>> supposed to stand for?
>
>
>I know that VT is 'vertical tab'.  As for SOH, I have no idea.

SOH is "Start Of Header".  It's used to start a frame in many synchronous
data communications protocols.  (SYN, for "SYNchronize", is used to fill
idle time on the link.  The arrival of a SOH indicates that a frame follows.)

--Pete Poorman
  pwp@shamash.cdc.com

chaffee@reed.UUCP (Alex Chaffee) (02/25/90)

In article <14233@reed.UUCP> I wrote:
>  Does anyone know what VT and SOH are supposed to stand for?

Thanks for all the replies.  You can stop sending them now... :)


-- 
Alex Chaffee
chaffee@reed.UUCP
Reed College, Portland OR 97202
____________________

svc@well.sf.ca.us (Leonard Rosenthol) (02/25/90)

In article <14233@reed.UUCP> chaffee@reed.UUCP (Alex Chaffee) writes:
>In article <38830@apple.Apple.COM> tecot@Apple.COM (Ed Tecot) writes:
>
>Sorry, I didn't bother with Help.  Does anyone know what VT and SOH are
>supposed to stand for?
>-- 
	VT  = Vertical Tab
	SOH = Start of Header

-- 
+--------------------------------------------------+
Leonard Rosenthol        |  GEnie : MACgician
Lazerware, inc.          |  MacNet: MACgician
UUCP: svc@well.UUCP      |  ALink : D0025

Michael.Burton@p3.f200.n226.z1.FIDONET.ORG (Michael Burton) (02/26/90)

   Alex Chaffee left the ASCII codes for several of the special function
keys on the extended keyboard, then asked:
> Does anyone know what VT and SOH are supposed to stand for?
   
   I like these easy questions.  VT is Vertical Tab.  SOH is Start Of
Header.


--  
Michael Burton via cmhGate - Net 226 fido<=>uucp gateway Col, OH
UUCP: ...!osu-cis!n8emr!cmhgate!200.3!Michael.Burton
INET: Michael.Burton@p3.f200.n226.z1.FIDONET.ORG

oster@well.sf.ca.us (David Phillip Oster) (02/26/90)

Here is a fragment of my personal include file for handling the keyboard.
Remember, the numeric keypad has a key that says "Clear" on it, so it should
be a synonym for Clear on the Edit menu, even though it generates the same
ascii code as the Escape key. The escape key of course, should be a synonym
for <Command>-<period> or, in a dialog, for (Cancel).

/* ascii code definitions returned by macintosh special keys */
#define HOMECHAR	1
#define ENTERCHAR	3
#define ENDCHAR		4
#define HELPCHAR	5
#define BACKSPACECHAR 8
#define PAGEUPCHAR	11
#define PAGEDOWNCHAR 12
#define RETURNCHAR	13

/* ascii code definitions returned by arrow keys */

#define ESCCHAR 27
#define CLEARCHAR 27
#define LEFTCHAR 28
#define RIGHTCHAR 29
#define UPCHAR 30
#define DOWNCHAR 31

#define DELCHAR		127

/*
 * clear, escape, and ^[ all generate the same code.
 * on the small american adb keyboard, the following keyboard 
 * numbers apply:
 * CLEARCHAR (0x47) in the 2nd byte,
 * an escape (0x35).
 * an ^[ has 0x21.
 *
 * LEFTCHAR (0x7B) = ^~()
 * RIGHTCHAR (0x7C) = ^ ()
 * UPCHAR (0x7D) = ^~()
 * DOWNCHAR (0x7E) = ^_ (1B)
 *
 * With 1 keyboard, the 3rd byte reports "2"
 */
-- 
-- David Phillip Oster - Note new address. Old one has gone Bye Bye.
-- oster@well.sf.ca.us = {backbone}!well!oster