Game Development Community

[BUG T3D 1.1 b3] CapsLock not evaluated in GuiTextEditCtrl - LOGGED

by Nicolas Buquet · in Torque 3D Professional · 04/06/2011 (7:37 am) · 1 replies

Hi,

it seems that CAPSLOCK key is not considered in text input in T3D 1.1 beta 3, tested in the console input and in GuiTextEditCtrl.

Caps letters typed with CAPSLOCK on result in the lowercase character input.

If you type any key that is below the function keys with CAPSLOCK on, on my french keyboard, you should type char 0 to 9. It is not actually the case.

Whatever the state of CAPSLOCK is (on or off), the input char is the same (always lowercase). Uppercase characters can be typed in with the SHIFT key.

To correct this, here is what I've done:

In file "WinDispatch.cpp", in '_keyboardEvent' method:

// Track modifier keys
	U32 modifier = 0;
	switch (newVirtKey) 
	{
	case KEY_LALT:     modifier = IM_LALT;   break;
	case KEY_RALT:     modifier = IM_RALT;   break;
	case KEY_LSHIFT:   modifier = IM_LSHIFT; break;
	case KEY_RSHIFT:   modifier = IM_RSHIFT; break;
	case KEY_LCONTROL: modifier = IM_LCTRL;  break;
	case KEY_RCONTROL: modifier = IM_RCTRL;  break;
	}

	// NB MODIF CAPSLOCK
	keyboardState[VK_CAPITAL] = GetKeyState(VK_CAPITAL);
	// NB MODIF CAPSLOCK END

	if (make)
	{
		_ModifierKeys |= modifier;
		keyboardState[keyCode] |= 0x80;
	}
	else
	{
		_ModifierKeys &= ~modifier;
		keyboardState[keyCode] &= 0x7f;
	}

It works for me. I hope it will work and help others.

Nicolas Buquet
www.buquet-net.com/cv/