Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!mips!decwrl!shelby!agate!usenet From: deadman@garnet.berkeley.edu (Ben Haller) Newsgroups: comp.sys.mac.programmer Subject: Re: why don't i get any "keyUp" events? Message-ID: <1990Oct6.075532.22574@agate.berkeley.edu> Date: 6 Oct 90 07:55:32 GMT Sender: usenet@agate.berkeley.edu (USENET Administrator) Organization: Stick Software Lines: 43 In message <1990Oct6.034350.23107@athena.mit.edu>, fleabag@athena.mit.edu (jeff bellsey) says: > well, i wrote this simple utility which dumped all events > into a window to see why i wasn't getting any keyUp events > in my program. this program didn't get them either. > what could i be doing wrong? could it be the keyboard? my > spelling? the humidity!? > > btw, "gimme a break, man, i'm just starting out!" applies here. > > thanks *muchly* for any help! > > :jeff > fleabag@athena.mit.edu The problem is quite simple. In Inside Macintosh Vol. II, chapter 3 (Operating System Event Manager), on page II-70, is the routine SetEventMask. Excerpt: SetEventMask sets the system event mask to the specified event mask. The Operating System Event Manager will post only those event types that correspond to bits set in the mask...The system event mask is initially set to post all except key-up events. So what you need to do is just call SetEventMask with everyEvent (-1), and that should solve your problem. I *think* on old versions of the system software the event mask wasn't set back when an application quit, so you should set it on exit to everyEvent-keyDownMask or whatever (now I'm just going from memory, so the names may be wrong). I have a harder question. What the hell is the system event mask *useful* for?? Why does it exist? Why don't all applications get all events, and leave it at that? I mean, all it means is you have to have a default case in your switch statement in your event loop, and you pretty much always do anyway. Did Apple really think that programmers wouldn't know how to handle it if they received keyUp events? Or is there a more sane reason? I know the first time I wanted to get keyUp events it confused the hell out of me...bet it does to 90% of Mac programmers. Oh well. Apple is so easy to make fun of... -Ben Haller (deadman@garnet.berkeley.edu) "The gang and the government, no different..." - Jane's Addiction