KeyDown & KeyHit

BlitzMax Forums/MaxGUI Module/KeyDown & KeyHit

thalamus(Posted 2008) [#1]
I'm trying to convert a GUI project from Blitz+ to Blitz Max, bt I'm having trouble accurately replicating the KeyDown and KeyHit commands.

In B+ it seemed much easier - I simply had a big list of KeyDown or KeyHit checks for each key. Now I'm checking KeyUp interactions and event data all over the place.

Can anyone kindly provide a small testbed that accurately models these commands in Blitz Max?

(Perhaps I'm being Mr. Thicky and missing something very obvious...)


tonyg(Posted 2008) [#2]
Are you using old maxgui, new maxgui or no maxgui?
Are you using events driven key checking or keyhit/keydown?
Are you enabling polled input or not?
It might be best is for you to post a small example of what you have do far.
BTW : Bmax keyhit/keydown are the same as B2D/B3D if I remember correctly. For MaxguI have you checked the tutorial from Assari on this site which will cover this?


thalamus(Posted 2008) [#3]
At work right now with no access to my code, but after looking at the forums...

a) Am I right in thinking that key events are tied to an active canvas or panel?

b) Is it better to add my own hook for key checks? If so, is there a particular number of times per second I should check for keypresses?

c) What precisely is EnablePolledInput for?


tonyg(Posted 2008) [#4]
a) Not sure what you're asking. The event is triggered against a gadget which is obtained using eventsource.
b) Depends on what issues you have with the native hooks for key events.
c) Taken from the only two hits on enablepolledinput :
To get the normal Key and Mouse commands to work within a Canvas you have to enable the 'polled Input'. This is done by using the undocumented command 'EnablePolleDInput()'. But keep in mind that when using this you don't get the whole CPU Advantage a only eventdriven app does have.



thalamus(Posted 2008) [#5]
Duh... I was missing the () on the end of the command... :-/

Thank you!