Jump to content
Sign in to follow this  

How to block alt-Numberpad up/down keys generating altcode characters in a TEdit.

Recommended Posts

The situation:

I'm trying to emulate a combobox using a buttoned edit control and another parented control as the "box".  This works fairly well, but I want to handle the standard Windows combobox hotkeys for toggling the box visibility which are F4 (easy) and Alt-Up/Alt-Down (much less easy as it turns out since I almost always use the up down arrows on the numberpad.)


The problem:

Using Alt-Up and Alt-Down from the numberpad (as opposed to the up/down dedicated keys) generates alt code characters.  This happens even if the numlock is off (I was surprised by this.)


The only solution I've found:

I'm just filtering out the possible alt-code characters in OnKeyPress.  This isn't ideal as if you hold down Alt and just hit up or down like crazy you can generate a large number of different characters, and I'd like to filter them all or come up with a much better way than an overly large case statement.


Any thoughts or ideas?


Share this post

Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this