Path: utzoo!censor!geac!torsqnt!news-server.csri.toronto.edu!mailrus!uunet!dino!ux1.cso.uiuc.edu!ux1.cso.uiuc.edu!uxa.cso.uiuc.edu!mms00786 From: mms00786@uxa.cso.uiuc.edu Newsgroups: comp.windows.ms Subject: Re: Error checking in Edit boxes. Message-ID: <118500038@uxa.cso.uiuc.edu> Date: 5 Jul 90 13:28:00 GMT References: <118500037@uxa.cso.uiuc.edu> Lines: 27 Nf-ID: #R:uxa.cso.uiuc.edu:118500037:uxa.cso.uiuc.edu:118500038:000:1219 Nf-From: uxa.cso.uiuc.edu!mms00786 Jul 5 08:28:00 1990 Ref: Keying off of WM_CHAR messages. Perhaps I wasn't very clear in my first post. The edit box in my dialog box must have a valid value, except possibly when the user types in an invalid value and then directly hits the cancel button. For example, suppose 32 is an invalid entry. The user types in 32, then hits "OK". The edit box should beep, and redirect focus to itself. Suppose the user types in 32, then hits "Cancel". This is perfectly acceptable, and there should be no beep, nothing. So, how do I find out from within the edit box (or possibly somewhere else), when to check for a valid entry? I have discovered a further complication : There *is* a difference between hitting the "OK" button and pressing Enter. (likewise between Esc and Cancel) The difference is that when you hit the Enter or Esc key, the current dialog control never loses input focus at all, even though the dialog function gets a IDOK or IDCANCEL message. Its very frustrating, because I don't even get a chance to do any error checking, the dialog box is simply swept out from under my feet! Please, any pointers or any sample code on how to implement an error checking edit control will be very much appreciated! Thanks. Milan .