C# form - checkboxes do not respond to plus/minus keys - easy workaround?

Posted by Scott on Stack Overflow See other posts from Stack Overflow or by Scott
Published on 2010-05-04T15:19:03Z Indexed on 2010/05/04 15:48 UTC
Read the original article Hit count: 163

Filed under:
|
|
|

On forms created with pre dotNET VB and C++ (MFC), a checkbox control responded to the plus/minus key without custom programming. When focus was on the checbox control, pressing PLUS would check the box, no matter what the previous state (checked/unchecked), while pressing MINUS would uncheck it, no matter the previous state.

C# winform checkboxes do not seem to exhibit this behavior.

Said behavior was very, very handy for automation, whereby the automating program would set focus to a checkbox control and issue a PLUS or MINUS to check or uncheck it. Without this capability, that cannot be done, as the automation program (at least the one I am using) is unable to query the current state of the checkbox (so it can decide whether to issue a SPACE key to toggle the state to the desired one).

I've gone over the properties of a checkbox in the Visual Studio 2008 IDE and could not find anything that would restore/enable response to PLUS/MINUS.

Since I am in control of the sourcecode for the WinForms in question, I could replace all checkbox controls with a custom checkbox control, but blech, I'd like to avoid that - heck, I don't think I could even consider that given the amount of refactoring that would need to be done.

So the bottom line is: does anyone know of a way to get this behavior back more easily than a coding change?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET