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 / PictureBox Inputs

Author
Message
XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 22nd Jan 2008 01:06 Edited at: 22nd Jan 2008 01:37
I have a form(frmMain), and within this form I have a DB3D being displayed through through a picture box(as shown in the .NET WinForms VB Example). I want to be able to navigate around 3D space using this 'Viewport' as i'm creating a space map making program. Problem is, though my 3D and camera commands seem to be displaying fine through this viewport...it wont take any input from the keyboard. The only input i'm able to use is ControlCameraWithArrowKeys...in which the camera will move when an arrow key is pressed. However, when I use if/then statements using ShiftKey/ControlKey, etc, even using a scan code I had no luck...i can't get any interaction within my picture box. It seems to accept other events such as menu clicks, etc...but nothing from the keyboard. The same commands seem to work when using the gdk directly(not within a form or a picture box). I'm not getting any errors at all.

I think I must be leaving something out, but not sure. To test it, i'm using the CamX variable and a label for the moment. Ideas anyone? My module code is below, thanks in advance.



CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Jan 2008 02:01 Edited at: 22nd Jan 2008 02:01
try setting the form's KeyPreview property to true, iirc this forces the keyboard events to be registered with the controls on the form. Then you can manipulate at the control level for the pbox... iirc

My DBP plugins page is now hosted [href]here[/href]
XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 22nd Jan 2008 02:23
Tried your suggestion, was certain it might work...but it didn't do it. Thanks though.

tparkin
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location:
Posted: 22nd Jan 2008 02:47
Hi,

This is hard to say since it depends on how DarkGDK works. Here are my suggestions:

- You want to try forwarding all key events from your Windows message handling to the PictureBox control.

- Set focus on the PictureBox control. Windows has a SetFocus() command but it might require something similar in order to get the PictureBox control to receive the keyboard input.

- If you can, get the DirectX device and change the input mode for the keyboard to "immediate" or whatever the mode is that ignores which window the keys are pressed in.
XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 22nd Jan 2008 03:00
i set the focus to the picture box control...not clear on how to perform your first and last suggestion...can you be a bit more specific please?

tparkin
17
Years of Service
User Offline
Joined: 28th Mar 2007
Location:
Posted: 22nd Jan 2008 05:39
For the first suggestion, it's assuming your window has a message loop. If you're writing this in a language like VB I'm not sure if they expose you to this level of Windows functionality. If you can access the message loop (every Windows application has one, you'd have to search for how to access it in VB) you just send your message structures (MSG) to the PictureBox control. Again, in VB I don't know if this level of control is provided. I'm sure it is but it's probably not as accessible as lower level languages.


As for my DirectX suggestion, I was actually referring to DirectInput. I'm not sure if DarkGDK uses DirectInput for those commands (in which case my suggestion above might be more accurate) but if it does, you'd need to get the DirectInput pointer and change the keyboard device to Exclusive mode, which will allow you to receive all input even if your PictureBox isn't the focus of the input.

These are only suggestions. I don't know the inner workings of DarkGDK so I don't know if they will fix your problem. My first suggestion (top of this post) is probably worth a try. The other one isn't worth the effort unless someone can confirm that these input functions use DirectInput.
XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 22nd Jan 2008 05:51
Thanks, i'll give it a shot in the morning.

XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 22nd Jan 2008 21:43 Edited at: 22nd Jan 2008 21:45
Tried it, no luck

I don't get why oDBCamera.ControlCameraUsingArrowKeys works, yet nothing else does.

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 22nd Jan 2008 22:53
if you search this forum I think you'll find some info on the message pump issue, in this same context iirc

My DBP plugins page is now hosted [href]here[/href]
XFS Illusion
18
Years of Service
User Offline
Joined: 20th Apr 2006
Location:
Posted: 23rd Jan 2008 18:45
I've searched with no real results for this problem. I also checked devshed for vb.net(awaiting responses). Message Pump?

CattleRustler
Retired Moderator
21
Years of Service
User Offline
Joined: 8th Aug 2003
Location: case modding at overclock.net
Posted: 23rd Jan 2008 21:25
yeah, the windows messages for the keyboard and mouse, and the fight between winforms and dgdk windows. something like that

My DBP plugins page is now hosted [href]here[/href]

Login to post a reply

Server time is: 2024-11-19 23:15:43
Your offset time is: 2024-11-19 23:15:43