Re:TEdit - Edit Box makes ding sound
Quote
> void __fastcall TFrCueGastos::Ed1KeyPress(TObject *Sender, char &Key)
> {
> if (Key == 13)
> {
> Key = 0;
> Perform(WM_NEXTDLGCTL, 0, 0);
> }
> }
I prefer this:
if ( Key == VK_RETURN )
{
Key = 0;
SelectNext( static_cast<TWinControl*>(Sender), true, true );
}
It use the windows define so it is clearer to read and is self-documenting.
I always get uncomfortable if I see a {*word*192} literal value in the code. It
is never explained and is hard to change if necessary.
It also uses the VCL call, which just looks cleaner to me.
+===================================================+
| Jonathan Arnold (mailto:jdarn...@buddydog.org) |
| http://www.buddydog.org |
+===================================================+
Grossman's Law: Complex problems have answers that are
easy to discover and understand, but wrong.