Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
No stinkin Valid
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00452154
Message ID:
00452561
Views:
24
>I'm sorry I must be missing something. if that code is at the top of the event how does the code code below it run. There is code in the valid. I do not wish it to run when "cancel" or "close" is clicked. I hope that makes it clearer.

Copy the code into a prg, run it and see ;)

Look at the Valid code again - if LastKey() is not 27 - i.e., not a Cancel action - the Valid code runs; if it is a Cancel action, the Valid code does not run.

You did say close button, so I also should have included code to allow for the "x" button being clicked. Using this revised valid below and try it then - perhaps it's clearer, too.
Procedure Text1.Valid
     If LastKey() = 27 Or thisform.ReleaseType = 1
          ** cancel button or "x" close button clicked
          ** don't run Valid code.
          Return .T.
     Else
          ** normal Valid code
          Return !"-" $ this.Value
     EndIf
EndProc
Insanity: Doing the same thing over and over and expecting different results.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform