Board index » cppbuilder » Using Return Key Within an OnKey Event Handler for Return Key

Using Return Key Within an OnKey Event Handler for Return Key

I am trapping the Return key in the OnKeyPress event handler, doing some
error checking, and then calling MessageBox to display an error message. All
is well if the user dismisses the message box with a mouse click or the
spacebar. However, when the user presses the Return key to acknowledge the
message box, it closes and immediately displays again. Is there an easy way
to prevent this from happening?

Thanks,
Steve

 

Re:Using Return Key Within an OnKey Event Handler for Return Key


In the OnKeyPress Event set Key = NULL;  had this happen myself,  the other key
to look out for is F10

Marci

Quote
Steve Bukoski wrote:
> I am trapping the Return key in the OnKeyPress event handler, doing some
> error checking, and then calling MessageBox to display an error message. All
> is well if the user dismisses the message box with a mouse click or the
> spacebar. However, when the user presses the Return key to acknowledge the
> message box, it closes and immediately displays again. Is there an easy way
> to prevent this from happening?

> Thanks,
> Steve

Re:Using Return Key Within an OnKey Event Handler for Return Key


Marci,

Thank you! It works perfectly now.

Steve

Other Threads