In my valid() I do this: if Thisform.ReleaseType = 1 && did they click the close box? return .T. endif
----- Original Message ----- From: Rafael Copquin To: [email protected] Sent: Wednesday, October 07, 2009 6:37 AM Subject: Re: VFP9 - Valid > (Should I remove the valid clause and make it part of the OK command?) No, what you can do is create a form property, ie lExit and code like this: **text with valid condition (in the valid event) if lastkey() = 27 thisform.lExit = .t. return 1 endif if thisform.lExit = .f. ** your validation ** if validation is ok, then return 1 ** else, error message and return 0 endif ** in the keypress event of that button lparameter nKeyCode,nShiftAltCtrl if nKeyCode = 27 release thisform endif ** make the exit button a cancel button (the cancel property = .t., then it will issue a chr(27) -- escape) ** also make thisform.lExit = .t. in the click event of the exit button Try something like this and you will obviate the error message when they go away (you might have to play with thisform.lExit, setting it to .f. or .t. as needed) Rafael Copquin ----- Original Message ----- From: "Sytze de Boer" <[email protected]> To: <[email protected]> Sent: Tuesday, October 06, 2009 8:54 PM Subject: VFP9 - Valid >I have a form with a bunch of text boxes > It has 2 command buttons, OK and CANCEL > > One of the TEXT boxes has a valid condition that says "Sorry, Reference > may > not be left blank" > My client says, Hang on, I just clicked the Cancel button, I don't want to > enter a Reference > But I can't find a way to do this. > > (Should I remove the valid clause and make it part of the OK command?) > > > -- > Regards > Sytze de Boer > Kiss Systems > Hamilton, NZ > Ph: 64-7-8391670, Mob:021 937611, > www.kiss.co.nz > ***Email is a great medium for distributing > misunderstandings...*** > > > --- StripMime Report -- processed MIME parts --- > multipart/alternative > text/plain (text body -- kept) > text/html > --- > [excessive quoting removed by server] _______________________________________________ Post Messages to: [email protected] Subscription Maintenance: http://leafe.com/mailman/listinfo/profox OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech Searchable Archive: http://leafe.com/archives/search/profox This message: http://leafe.com/archives/byMID/profox/59bd1219c1e84223b72b16fbd9a95...@w2k3s02 ** All postings, unless explicitly stated otherwise, are the opinions of the author, and do not constitute legal or medical advice. This statement is added to the messages for those lawyers who are too stupid to see the obvious.

