Cursors and getkey

BlitzPlus Forums/BlitzPlus Programming/Cursors and getkey

Nebula(Posted 2003) [#1]
I noticed the cursor keys are not registering using getkey. Will they be added in a future update?


Snarty(Posted 2003) [#2]
Why not use a bitmask method? Small Example below.
[Code]Const CLeft=%1
Const CRight=%10
Const CUp=%100
Const CDown=%1000

Scw=ClientWidth(Desktop())
Sch=ClientHeight(Desktop())
Win=CreateWindow("Testing",(Scw-220)/2,(Sch-70)/2,220,70,Desktop(),25)
CreateLabel "Cursor Key Test, Hold a cursor key down...",4,8,ClientWidth(Win),16,Win

Repeat
Ev=WaitEvent()
Repeat
Txt$=""
If CursorsDown() And CLeft Txt$=" Left "
If CursorsDown() And CRight Txt$=" Right "
If CursorsDown() And CUp Txt$=Txt$+"Up"
If CursorsDown() And CDown Txt$=Txt$+"Down"
If HTxt$<>Txt$ SetStatusText Win,Txt
HTxt$=Txt$
Until Not CursorsDown()
SetStatusText Win,""
FlushEvents
Until KeyHit(1) Or Ev=$803

Function CursorsDown%()

Local Mask%=0
If KeyDown(203)
Mask=CLeft
ElseIf KeyDown(205)
Mask=CRight
EndIf
If KeyDown(200)
Mask=Mask Or CUp
ElseIf KeyDown(208)
Mask%=Mask% Or CDown
EndIf
Return Mask%

End Function[/code]