Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!swatsun!jackiw From: jackiw@cs.swarthmore.edu (Nick Jackiw) Newsgroups: comp.sys.mac.programmer Subject: Re: Masking Modified Characters Message-ID: Date: 16 Aug 90 16:13:05 GMT References: <3903@husc6.harvard.edu> <1990Aug16.152714.18081@ux1.cso.uiuc.edu> Reply-To: jackiw@cs.swarthmore.edu (Nick Jackiw) Organization: Visual Geometry Project, Swarthmore College, PA Lines: 40 Rich Siegel writes: .How does one avoid getting option-generated characters when using GetNextEvent? .For example, when I type Command-Option-P, I'll an event which tells me I've .typed Command-Option-pi, and I'm more interested in what the unmodified .character was. Is there a standard mask for turning modified characters into .standard ones, or is there some other hack? Martin Minow replies: .Hi Rich. You won't like this answer: I "solved" the problem by building .my very own hack KCHR resource that had no option tables. You have to .make sure you switch back to the original KCHR when your application .exits (or multifinder switches). This is definately a "kids, don't .try this at home" trick; send me mail if you want the code. Steve Dorner posts code: .I have a hack; it's the best way I could come up with, and I think it's .compatible, at least with 8 bit languages. Comments, anyone? [Code deleted] Steve's method is the sanctioned one (cf. TechNote#263), but assumes that the proper keycode is stored in the low-byte of KeyTrans' return. This is apparently incorrect; the byte it returns in is either high or low (I think depending on the script). The illustration (Figure 7, V-195) implies it's in the low byte, but it's an example, not a rule. If you're checking to see if keyCode = some specific option+whatever, you can check ((whatever=maskedKey mod 256) or (whatever=maskedKey div 256)); on the other hand, if you need it to return an arbitrary maskedKey, I'm not sure how you can tell which of the two bytes contains the keycode. Perhaps check against some known value? Even this seems keyboard/script specific. Just another cook for your soup, -- -----Nick Jackiw [jackiw@cs.swarthmore.edu|jackiw@swarthmr.bitnet------ "This orbe of starres fixed infinitely vp extendeth hitself in altitvde sphericallye, and therefore immovable the pallace of foelicity garnished with perpetvall shining glorious lightes innvmerable." - Thomas Digges