Re:KeyDown and Key=0
The first thing I should point out to you is that the arrow keys don't ever
trigger the OnKey... events, so you can't test for VK_LEFT, VK_RIGHT, etc
the way you're doing it
As for your actual delemna, it looks like you're trying to prevent the user
from entering anything but numers, right? Try this instead:
#include <ctype.h>
void __fastcall TfrmMain::txtNummerVonKeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key != VK_BACK && Key != VK_DELETE && !isdigit(Key) )
Key = 0;
If that doesn't do what you need, then try it inside the OnKeyPress event
instead of OnKeyDown
Gambit
Quote
"Andreas Homa" <h...@iml.fhg.de> wrote in message
news:3A65A4E2.678D3BD4@iml.fhg.de...
Quote
> if I set the Key-Value of a KeyDown Method to 0, nothing really happens.
> The key is shown in the TEdit as normal. Who can help?? The Code of the
> KeyDown-Method looks like this:
<snip>
> The KeyPreview of the Form is set to true!!
> if I press the 'a'-Button it character should not appear in the
> edit-Field. But It does - although I set Key = 0.