I just found out, that this seems not a MacOS-specific problem.
The following test code is created on Windows 10, and shows the different values returned by the command and used as constant values:
Code: Select all
; Output the constant values for Keypress (used for CanvasGadget below):
Debug "Constant values of #PB_Key_Up/Down/Left/Right:"
Debug #PB_Key_Up ; will give 200
Debug #PB_Key_Down ; will give 208
Debug #PB_Key_Left ; will give 203
Debug #PB_Key_Right ; will give 205
Procedure CheckKeyPress()
Protected eventtype, key, changed
Static x = 20, y = 20
eventtype = EventType()
If eventtype = #PB_EventType_KeyDown
Key = GetGadgetAttribute(0, #PB_Canvas_Key)
Debug "Keypress = " + Key ; FIXME: the cursor keys will give 38 (up), 37 (left), 39 (right), 40 (down), so the #PB_Key_Up/Down/Left/Right constants can't be used!
Select Key
Case 38 ; don't work: #PB_Key_Up
y - 1
changed = #True
Case 40 ; don't work: #PB_Key_Down
y + 1
changed = #True
Case 37 ; don't work: #PB_Key_Left
x - 1
changed = #True
Case 39 ; don't work: #PB_Key_Right
x + 1
changed = #True
EndSelect
EndIf
If changed = #True
Debug "New values: x = " + x + " / y = " + y
EndIf
EndProcedure
OpenWindow(0, 50, 50, 400, 300, "Canvas test window - press cursor keys!")
CanvasGadget(0, 5, 5, 390, 290, #PB_Canvas_Keyboard)
BindGadgetEvent(0, @CheckKeyPress(), #PB_EventType_KeyDown)
SetActiveGadget(0)
Repeat
event = WaitWindowEvent()
Until event = #PB_Event_CloseWindow
Don't know, if this also qualifies as a bug?