..keydown/mousedown..

BlitzMax Forums/MaxGUI Module/..keydown/mousedown..

Naughty Alien(Posted 2010) [#1]
..well..i just want to make this small piece of code work as im expecting for keydown/mouse down..meaning, long as i hold down specific key, text should be displayed on screen, but in this case, its not like that..text is drawn only every time i press key, sort of keyhit, what i dont want..so how to do it guys?
Graphics 360, 240
While Not KeyHit(KEY_ESCAPE)
	WaitEvent()
	Select EventID()
		Case EVENT_KEYDOWN
			Select EventData()
		         Case KEY_SPACE
		          DrawText "SPACE", 10, 10
		      End Select
	End Select
	Flip
	Cls
Wend


..similarly, if i do this for mouse, its working(holding left mouse button down), but soon as i move mouse just a bit, text disappear until i press again..ill appreciate some exact input here, and how to do this..

Graphics 360, 240
While Not KeyHit(KEY_ESCAPE)
	WaitEvent()
	Select EventID()
		Case EVENT_MOUSEDOWN
			Select EventData()
		         Case MOUSE_LEFT
		          DrawText "LEFT MOUSE", 10, 10
		      End Select
	End Select
	Flip
	Cls
Wend



Brucey(Posted 2010) [#2]
KEY_DOWN is only raised when the key is initially pressed, just like KEY_UP is raised when you release the key.
The easiest way to know if a key is down, is that a KEY_UP hasn't been raised for it yet (since the KEY_DOWN). There is in fact a private array which keeps track of this, but Mark didn't want to make it public, so you'll have to do the key status tracking yourself :-)


Naughty Alien(Posted 2010) [#3]
..ahh..allrighty..i didnt know that..thanks Brucey ;) you are very handy fella :)


Hardcoal(Posted 2016) [#4]
I still cant get this maxgui craziness,
I have child windows and I can get to read the keyboard presses
nor the mouse presses while im on top of them.
how can I get a read regardless of where my mouse is or when a child window is selected i need to get the keyboard.?

Tnx


BlitzMan(Posted 2016) [#5]
FlushMouse()
FlushKeys()

Help sometimes not always i find.


Hardcoal(Posted 2016) [#6]
This doesnt work...
You cant get readings while you are out of the canvas window..