Path: utzoo!utgpu!watserv1!watmath!att!att!linac!uwm.edu!rpi!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!uflorida!haven!cs.wvu.wvnet.edu!cerc.wvu.wvnet.edu!babcock.cerc.wvu.wvnet.edu From: vrm@babcock.cerc.wvu.wvnet.edu (Vasile R. Montan) Newsgroups: comp.sys.mac.programmer Subject: Re: How does one detect whether a modifier key is being held down? Message-ID: <964@babcock.cerc.wvu.wvnet.edu> Date: 2 Nov 90 21:36:51 GMT References: <5467@quiche.cs.mcgill.ca> Sender: news@cerc.wvu.wvnet.edu Lines: 24 I accomplished this same thing by checking the modifiers each the program cycled through its event loop. You ordinarily have an if/then statement using GetNextEvent. GetNextEvent, a boolean function, returns FALSE if the event is the Null Event (i.e., if there have been no events.) Nevertheless, the variables you pass to GetNextEvent are given the correct values, so that your Modifiers variable will be set to reflect the current state of the modifier keys. > I wish to do the samething. Can't seem to find anything in Inside Mac. > I look up the stuff pertaining to keys, keyboard, and modifiers. It just > says a modifier doesn't generate an event. So does this mean I have to > generate my own application event (appEvt) and check the modifier flag. Or > is there a toolbox global where all key press are stored? You don't have to mess with an application event. Use an ELSE to catch those cases where GetNextEvent returns FALSE, and use the Modifiers variable however you want. I had a NewModifiers and an OldModifiers variable, so that I could respond to a change in the state of the keys. (If you want to send mail to me, please send it to un020070@vaxa.wvnet.edu. I'm not writing from home.) --Kurisuto