Game Development Community

Deactivating the keyboard properly?

by Neil Marshall · in Torque Game Engine · 04/18/2006 (10:47 am) · 0 replies

I'm having trouble deactivating the keyboard in C++ properly. I looked up how the console does it and implemented that in the on Focus and kill Focus events of TGE so that when the user alt-tabs directInput stops working. That works fine, EXCEPT when I go back to the main menu. For some reason the directInput is still enabled and when you type in the username textbox you get ddoouubbllee the letters. I deactivated the keyboard by removing focus from the app and setting it again and it goes back to single letter typing.

Does anyone know why the keyboard isn't getting disabled when I disconnect?



In WM_KILLFOCUS:
DInputManager* mgr = dynamic_cast<DInputManager*>( Input::getManager() );
         if ( mgr ) {
            mgr->deactivateKeyboard();
         }

In WM_SETFOCUS:
DInputManager* mgr = dynamic_cast<DInputManager*>( Input::getManager() );
         if ( mgr ) {
            mgr->activateKeyboard();
         }

Am I disabling the keyboard properly in the on/kill focus events? I noticed that there were deactivateKeyboard() and disableKeyboard() events in DInputManager so I could be calling the wrong function.