Game Development Community

keeping numlock in an "on" state

by Richard Preziosi · in Torque 3D Professional · 03/26/2011 (8:58 pm) · 3 replies

Does anyone have any insight on this? I need numlock to work, but to not toggle the state of the numpad keys. To my best efforts I've only been able to get "on" to stick for 2 numlock presses by adding some code to winInput.cpp.

if(0 == GetKeyState(VK_NUMLOCK)){
    INPUT input;
    size_t sz = sizeof(INPUT);
    memset(&input, 0, sz);
    input.type   = INPUT_KEYBOARD;
    input.ki.wVk = VK_NUMLOCK;
    SendInput(1, &input, sz);}

Perhaps I am doing something stupid or missing something relevant, or perhaps i am sleep deprived, either way, maybe someone else has some insight.

#1
03/27/2011 (5:27 am)
Treat numerics differently based on numlock state. That way you can utilize numlock to toggle whatever, and your input stays consistent.

I think its a poor decision to fiddle with my keyboard, and most definately don't do that if I'm in , say, a chatline.
#2
03/27/2011 (6:29 am)
I think its a poor decision for the menu key to be disabled on my remote during dvd previews, but life happens. I think a consistent means of input would be best, numlock still works as a key with the above code. Besides T3D turns numlock on when it starts up anyways.
#3
03/27/2011 (1:39 pm)
Blocking the menu key is a feature that is actively enabled on your hardware, in response to a setting by Disney that it should be disabled so your kids will pester you to buy more of their crap - your choice to buy it :) - regardless I fully agree a consistent method/means of input is expected & preferable.

hogging the state of numlock just didn't strike me as providing consistency as its expected to be toggleable - and numlock toggle is about the greatest indicator of a living system, even when everything else looks frozen.

It it does provide the most consistent behaviour, then I'm all for it.