Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK .NET / Need to get Keyboard respone in VB.Net

Author
Message
Frank C
13
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Houston TX
Posted: 4th Jul 2010 16:07
I am trying to get the Up/Down/Left/Right keys to manipulate my opject and perform soem other calculations. I have everything working but this. I a thread that had some information but the threads get locked here if no response for a while and can't relate back.
It mentions that since I am using WinForms I have to use the CtlDarkGDKViewport control on the form to get the keyboard event, I have tried using the KeyFown event but am having some issues passing that back to the Application Class to use in the Gameloop procedure. The DarkGDK.IO.Keyboard proprties are readOnly so I can't set them. Any help would be appreciated.
Huntinator
14
Years of Service
User Offline
Joined: 21st Dec 2009
Location: Channel 57
Posted: 13th Jul 2010 23:39
Put this in your form:


Paste this where ever you need to detect if a key was pressed.


Hope it Helps.
Frank C
13
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Houston TX
Posted: 15th Jul 2010 21:49
Thanks i will give this a try later today or tonight when I get home
Frank C
13
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Houston TX
Posted: 16th Jul 2010 16:26
Tried it out, still did not work, looks like the KeyUp and KeyDown procedures are not being detected, I did get it to somewhat work with the KeyPress procedure but I had to constantly set the keycode value back to 0 in the code section or it would constantly run that section of code.



Huntinator
14
Years of Service
User Offline
Joined: 21st Dec 2009
Location: Channel 57
Posted: 18th Jul 2010 22:59
I forgot to mention that the form that you are detecting keys should have the KeyPreview property set to true. Then the Keydown and KeyUp Events should be raised properly. My apologies for forgeting to mention that.
Frank C
13
Years of Service
User Offline
Joined: 3rd Jul 2010
Location: Houston TX
Posted: 19th Jul 2010 20:24
That worked thanks

Login to post a reply

Server time is: 2024-04-23 22:05:16
Your offset time is: 2024-04-23 22:05:16