Keydown / modifiers in 1.12

BlitzMax Forums/BlitzMax Programming/Keydown / modifiers in 1.12

Will(Posted 2005) [#1]
' keydown.bmx

' the following code draws a circle if the
' program detects the spacebar is pressed
' and exits when it detects the ESCAPE key has
' been pressed

Graphics 640,480
While Not KeyHit(KEY_ESCAPE)
Cls
If KeyDown(MODIFIER_CONTROL) DrawOval 0,0,640,480
Flip
Wend


This code should work, right? For some reason it doesn't seem to.. What am I doing wrong? This is in bmax 1.12 on OS X 10.4.3

(grumbles about general bmax dysfunctionality)


nadia(Posted 2005) [#2]
This seems to work:

' keydown.bmx

' the following code draws a circle if the
' program detects the spacebar is pressed
' and exits when it detects the ESCAPE key has
' been pressed

' DrawOval only seems to work if I set a specific graphics driver
' but DrawRect() works without seting a graphics driver ?????

SetGraphicsDriver GLMax2DDriver() '<<<<< comment this out to test!

Graphics 640,480

While Not KeyHit(KEY_ESCAPE)
Cls

If KeyDown(KEY_SPACE)  Then
	
	SetColor 255,255,0
	DrawOval 50,50,100,100
	
	SetColor 0,0,255
	DrawRect 250, 50, 50, 50
End If
Flip
Wend


DrawOval()only seems to work if I set a specific graphics driver but DrawRect() works without seting a graphics driver?


PetBom(Posted 2005) [#3]
From the MAXGUI documentation:
The MODIFIER_COMMAND value should be used instead of MODIFIER_CONTROL with Menu hotkeys for best crossplatform compatability.

This is mentioned in the CreateMenu:TGadget() doc, but I guess it means that something has changed in how BMax handles modifier keys...


HappyCat(Posted 2005) [#4]
From what I can see the MODIFIER_ stuff is for GUI gadget hotkeys only. For KeyDown stuff you should use KEY_LCONTROL or KEY_RCONTROL (the more generic KEY_CONTROL seems to have vanished).

Lookup CreateMenu in the help.


Will(Posted 2005) [#5]
Thanks happycat :D