Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!umriscc!mcs213a.cs.umr.edu!mcastle From: mcastle@mcs213a.cs.umr.edu (Mike Castle) Newsgroups: comp.lang.pascal Subject: Re: Preset KeyPressed Function? Message-ID: <1728@umriscc.isc.umr.edu> Date: 25 Nov 90 23:11:45 GMT References: <9011251958.AA08961@euler.Berkeley.EDU> Sender: news@umriscc.isc.umr.edu Organization: University of Missouri - Rolla Lines: 34 I had a similiar problem using ReadKey. Turned out it was all poor programming. I was using a repeat until keypressed routine at the ends of some procedures so I could check my output (was directing it to screen during testing, went to printer later, so I had to put in a hold function). Unfortunately, that doesn't clear the keyboard buffer. Any subsequent keypressed call returned true. Also, readkey would return that keystroke immediately. I've since gone to using ch:=readkey when ch is type ch and not used for anything else. I don't use it all that often, so I've never written an official hold procedure (though I probably should). Anyway, if you have a keypressed routine earlier, but not a corresponding readkey for it, that might be your problem. Be sure to clear the keyboard buffer before issuing the next keypressed or whatever. hmm... what about: Procedure ClearKbd; Type Ch : Char; Begin While KeyPressed do Ch:=ReadKey; End; That looks like it should do it..... Hope it helps. -- Mike Castle (Nexus) S087891@UMRVMA.UMR.EDU (preferred) | ERROR: Invalid mcastle@mcs213k.cs.umr.edu (unix mail-YEACH!)| command 'HELP' Life is like a clock: You can work constantly, and be right | try 'HELP' all the time, or not work at all, and be right twice a day. |