Event 515

BlitzMax Forums/BlitzMax Programming/Event 515

CS_TBL(Posted 2006) [#1]
Trying to port my own getASyncKeyState-based keyroutine from B+ to bmax I stumbled upon some problem.

Without getting into details, there're 3 phases for a keypress.

phase 1: eventid 513 (key pressed down)
phase 2: eventid 515 (key repeat/hold down)
phase 3: eventid 514 (key up/released)

So, 515 occurs when you have keyrepeat, which is required for own text'ish editors, or any other app with keyboard-navigation for that matter.


When scanning these events with a simple app like this:
Strict
Local window:TGadget=CreateWindow("o_O",0,0,640,480)
Local ohboy_this_canvas_so_rocks:tgadget=CreateCanvas(0,0,640,480,window)
ActivateGadget ohboy_this_canvas_so_rocks
OnEnd quit
Repeat
	WaitEvent()
	
	If EventID()=513 DebugLog "----"
	DebugLog "data: " + EventData() + " id: "+EventID()
	
	If EventID()=EVENT_WINDOWCLOSE End	
Forever

Function quit()
	GCCollect()
	End
End Function


It's clear that stuff like cursorkeys, page up/dn and a lot of other keys don't create that keyrepeat id (515). Which sucks, esp. since it did work in Blitzplus!

Because I don't get an event back, my routine isn't called, and simply said: I can't do much with all this..

(my routine itself isn't important here, it just stores the states for all the keys)

So simply said: I need an event (keyrepeat/515) for the keys that currently don't do that, but did so in B+

'Can we fix it' ? :P

(oh btw: you NEED a canvas .. is that normal??)


Azathoth(Posted 2006) [#2]
DebugLog EVENT_KEYCHAR
DebugLog EVENT_KEYUP
DebugLog EVENT_KEYDOWN



CS_TBL(Posted 2006) [#3]
You prolly didn't get the question right, the problem is that keys like the cursor, page up/dn, F-keys etc. don't create continuous 515-events (the keychar-ID). So at this stage I couldn't make my own keyboard-navigated editors (like for inputing text) with true keyrepeat (which is what you want!).


CS_TBL(Posted 2006) [#4]
see also:

(Blitz+)

; debugmode
CreateWindow("o_O",0,0,640,480)
Repeat
	WaitEvent()
	DebugLog EventID()
	If EventID()=$803 End
Forever
End


Here every key creates a keyrepeat event, also the cursors etc. and without the presence of a canvas.. so here's the difference with bmax!


Azathoth(Posted 2006) [#5]
I guess if you get a keydown event, the key is held down until you get a key up? It doesn't sound very safe, but thats the only thing I can think of.


CS_TBL(Posted 2006) [#6]
well I simply think it's a 'bug', as in: 'something that was forgotten to implement' .. but that's purely based on the idea of B+ and MaxGUI being more or less the same..

..to the bugshop with it..