Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!csd4.milw.wisc.edu!bionet!agate!ucbvax!ucsd!rutgers!att!chinet!saj From: saj@chinet.chi.il.us (Stephen Jacobs) Newsgroups: comp.sys.atari.st Subject: Handling mouse button pushes Keywords: Line A, events, debouncing Message-ID: <8086@chinet.chi.il.us> Date: 31 Mar 89 22:12:39 GMT Organization: Chinet - Chicago, Ill. Lines: 24 A while ago I asked for advice on how to sense mouse button pushes safely and reliably. Lars-Erik Osterud suggested using evnt_multi set to return on timer events to poll the button state. It's hard to explain exactly how, but even that VERY conservative approach seemed to run afoul of timing differences between window-moved messages and button pushes/releases (I really don't understand this stuff). Anyway, based partly on the above- mentioned conservative approach, I think I have a fairly general solution to how to use mouse button pushes in non-forms-oriented situations. Here are the principles: 1) Use the documented extended Line A variable to sense the mouse button state whenever it might be interesting. 2) Debounce all button state changes (an evnt_timer() call for 10 millisec. appears to be adequate). 3) Take no immediate action based on a mouse button state change. Instead set a flag, look for AES messages and let the VDI do anything it might have in progress. If appropriate, the routines that handle messages can reset the action flag. 4) Only after everyone else has had a crack at the machine state take action based on the mouse button state. This approach seems conservative enough that I'll be using it automatically from now on (I hate having to play for 2 weeks to get things to happen in the right order). The hardware is fast enough to cover a LOT of conservatism. Steve J.