[comp.sys.mac.programmer] Keyup Events In Think C

Jennings.Jennings@f31.n343.z1.FIDONET.ORG (Jennings Jennings) (12/02/90)

I have been playing with the TinyEdit sample that came with THINK C 4.0.  
I have tried and failed to find keyUp events in
CSwitchboard::ProcessEvent().  I test for them right after WaitNextEvent
which is called with everyEvent=0xFFFF.  Can anyone suggest what might be 
wrong?

--  
Jennings Jennings via cmhGate - Net 226 fido<=>uucp gateway Col, OH
UUCP: ...!osu-cis!n8emr!cmhgate!343!31!Jennings.Jennings
INET: Jennings.Jennings@f31.n343.z1.FIDONET.ORG

Greg@AppleLink.apple.com (Greg Marriott) (12/08/90)

In article <109417.276027AF@cmhgate.FIDONET.ORG> 
Jennings.Jennings@f31.n343.z1.FIDONET.ORG (Jennings Jennings) writes:
> I have tried and failed to find keyUp events [after calling WaitNextEvent]
> with everyEvent=0xFFFF.

There is a system event mask in low memory which is initialized to accept 
all events EXCEPT keyUp events.  This is because most apps don't care 
about when the keys are released, and keyUp events would "crowd out" other 
more important events in the queue.  You can set the system event mask by 
calling SetEventMask (see IM II, p.70).

Greg Marriott
Blue Meanie
Apple Computer, Inc.

time@tbomb.ice.com (Tim Endres) (12/08/90)

In article <109417.276027AF@cmhgate.FIDONET.ORG>, Jennings.Jennings@f31.n343.z1.FIDONET.ORG (Jennings Jennings) writes:
> I have been playing with the TinyEdit sample that came with THINK C 4.0.  
> I have tried and failed to find keyUp events in
> CSwitchboard::ProcessEvent().  I test for them right after WaitNextEvent
> which is called with everyEvent=0xFFFF.  Can anyone suggest what might be 
> wrong?

It is not Think C's problem.
Inside Mac Vol I page 256:
   NOTE: Remember that most applications will want to ignore Key-Up
         events; with the standard system event mask you won't get
         any.

Refer to trap SetEventMask() for further details.

tim.

-------------------------------------------------------------
Tim Endres                |  time@ice.com
ICE Engineering           |  uupsi!ice.com!time
8840 Main Street          |
Whitmore Lake MI. 48189   |  (313) 449 8288

hairston@henry.ece.cmu.edu (David Hairston) (12/09/90)

[Jennings.Jennings@f31.n343.z1.FIDONET.ORG (Jennings Jennings) writes:]
[] I have been playing with the TinyEdit sample that came with THINK C 4.0.  
[] I have tried and failed to find keyUp events in
[] CSwitchboard::ProcessEvent().  I test for them right after WaitNextEvent
[] which is called with everyEvent=0xFFFF.  Can anyone suggest what might be 
[] wrong?

this comes up from time to time (although it's documented clearly in
Inside Mac, Vol. I, Ch. 8 - Toolbox Events and IM-II).

the global System Event Mask is pre-defined as:
everyEvent - keyUpMask

in order to get KeyUp posted at all you must redefine the event mask.
you can add/subtract KeyUp but it is bad karma to remove other events.

SetEventMask(everyEvent);    /* enables KeyUp */
or
SysEvtMask = everyEvent;

of course, you'll want to save the old mask and restore it when you
don't need the change ...

  -dave-  
hairston@henry.ece.cmu.edu

bin@primate.wisc.edu (Brain in Neutral) (12/11/90)

From article <HAIRSTON.90Dec8134818@henry.ece.cmu.edu>, by hairston@henry.ece.cmu.edu (David Hairston):
> of course, you'll want to save the old mask and restore it when you
> don't need the change ...

In particular, when your application exits?
--
Paul DuBois
dubois@primate.wisc.edu

francis@daisy.uchicago.edu (Francis Stracke) (12/11/90)

In article <3560@uakari.primate.wisc.edu> bin@primate.wisc.edu writes:
>From article <HAIRSTON.90Dec8134818@henry.ece.cmu.edu>, by hairston@henry.ece.cmu.edu (David Hairston):
>> of course, you'll want to save the old mask and restore it when you
>> don't need the change ...
>
>In particular, when your application exits?

Or gets suspended by MF.

| Francis Stracke		| My opinions are my own.  I don't steal them.|
| Department of Mathematics	|=============================================|
| University of Chicago		| Until you stalk and overrun,	     	      |
| francis@zaphod.uchicago.edu	|  you can't devour anyone. -- Hobbes 	      |

Jim.Lynch@f444.n161.z1.FIDONET.ORG (Jim Lynch) (12/14/90)

 
> Msg#:18560 *UMACP*
> Subj: KEYUP EVENTS IN THINK C
> From:Jennings.Jennings@f31.n343.z1.FIDONET.ORG (Jennings Jennings)
> Date: 1 Dec 90 16:28:59 GMT
> Organization: FidoNet node 1:343/31 - SEA/MAC, Seattle WA
> Message-ID: <109417.276027AF@cmhgate.FIDONET.ORG>
> Newsgroups: comp.sys.mac.programmer
> 
> I have been playing with the TinyEdit sample that came with
> THINK C 4.0.  I have tried and failed to find keyUp events in
> CSwitchboard::ProcessEvent().  I test for them right after
> WaitNextEvent which is called with everyEvent=0xFFFF.  Can
> anyone suggest what might be wrong?
> 
> --  
> Jennings Jennings via cmhGate - Net 226 fido<=>uucp gateway Col, OH
> UUCP: ...!osu-cis!n8emr!cmhgate!343!31!Jennings.Jennings
> INET: Jennings.Jennings@f31.n343.z1.FIDONET.ORG
> 
 
The problem is that the OS event mask (InsideMac II-70) is set to
post all events except keyUp.   -Jim
 
/*********************************************************************/
/* Jim Lynch                           on BMUG BBS in Berkeley, CA   */
/*                                        (415) 849-BMUG             */
/*                                     or leave a voice message at:  */
/*                                        (415) 521-7367             */
/*********************************************************************/


--  
Jim Lynch - via FidoNet node 1:125/777
    UUCP: ...!uunet!hoptoad!fidogate!161!444!Jim.Lynch
INTERNET: Jim.Lynch@f444.n161.z1.FIDONET.ORG