Duncan, many thanks for that one - as long as you remove the PEEK_L from the "sv_keyq=" line to avoid a double PEEK_L it works well enough, though I can't make sense of the values in the queue itself - peek(bufpos2) or peek_w(bufpos2) returns almost random data, whereas if I use this routine to detect when to read sv_arbuf it seems to work OK and return ALT pressed or not in its first byte (255 or 0) and the code of key pressed in the second byte of sv_arbuf
Any idea what values I SHOULD be finding in the queue? Or perhaps it's safer to do something like: IF NewKey THEN sv_arbuf = PEEK_L(SystemVariableBase+138) alt = PEEK(sv_arbuf) key = PEEK(sv_arbuf+1) END IF Even though I couldn't make sense of the data in the queue, this does seem to form the basis for a workable routine, so many thanks. -- Dilwyn Jones > What about checking for the position of the pointer to the current > input key > queue. Even if the same key is pressed repeatedly the position of > the buffer > pointer moves which each character input. I used this when I wrote > my screen > saver to check for repeatedly pressed keys. > > sv_keyq=PEEK_L(SystemVariableBase+76) : REM pointer to keyboard > queue > > NewKey=CheckKeys > > DEFine FuNction CheckKeys > LOCal KeyPress > REMark Returns 1 for keypress and 0 for no keypress > BufPos=PEEK_L(sv_keyq) > BufPos2=PEEK_L(BufPos+12) : REM last key pressed > IF BufPos2=OldPos : KeyPress=0 > IF BufPos2<>OldPos : KeyPress=1 > OldPos=BufPos2 > RETurn KeyPress > END DEFine CheckKeys > > The value in Bufpos might be usable to get the key combination, if > not > sv_arbuf could be peeked to get the value. > > Duncan > > > > > _______________________________________________ > QL-Users Mailing List > http://www.q-v-d.demon.co.uk/smsqe.htm > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.503 / Virus Database: 269.16.1/1140 - Release Date: > 19/11/2007 19:05 > _______________________________________________ QL-Users Mailing List http://www.q-v-d.demon.co.uk/smsqe.htm