In message ID <346F1EB1.174F@...> on 11/16/97, Rick Brown
<rbrown@...> wrote:
f> I wrote:
f> > > But if others tell you
f> > >you're crazy and that your code works fine, at least
f> you have another > >eye-witness that there is some
f> (intermittent) problem here.
f>
f> Terence replied:
f> > Perhaps it has something to do with the "repeat rate"
f> on your keyboard; > also, what vers of sys software are
f> both of you running...?
f>
f> I've tried this experiment with "key repeat" both on and off, and
f> "repeat rate" and "delay rate" set at various settings,
f> and I'm always getting the same results (namely, the key
f> up event is being recognized).
f>
f> I'm running OS 7.5, and using an "Extended Keyboard II".
I don't understand why Rick IS getting key-up events - they are normally
disabled by the OS. There is a "system event mask" which tells the system what
type of events to pay attention to. Normally the event mask masks out key up
events, so your application never receives them.
To enable key-up events, add this to your code:
POKE WORD _sysEvtMask, _everyEvent
to return to the default:
POKE WORD _sysEvtMask, (_everyEvent - 16)
Try the following program. Run it once as-is. Then comment out the first POKE
WORD line to see the difference.
Click the mouse to end the program.
DIM gQuit
END GLOBALS
LOCAL FN printEvents
theEvent = {EVENT}
SELECT theEvent
CASE _nullEvt
CASE _mButDwnEvt
PRINT "Mouse down"
CASE _mButUpEvt
PRINT "Mouse up"
gQuit = 1
CASE _keyDwnEvt
PRINT "Key down"
CASE _keyUpEvt
PRINT "Key up"
END SELECT
END FN
ON EVENT FN printEvents
gQuit = 0
'POKE WORD _sysEvtMask, _everyEvent 'enable key-up events
'POKE WORD _sysEvtMask, (_everyEvent - 16) 'disable key-up events
WINDOW 1
PRINT "Hit some keys, click the mouse to end"
DO
HANDLEEVENTS
UNTIL gQuit
- sent via BulkRate (http://members.aol.com/gregneagle/bulkrate/)