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:
00452464
Views:
21
>I meant to add.....to not let the valids run from other objects when button is clicked

This works for textboxes, etc., as well, e.g. run the following program, put a "-" in the textbox and tab out. The valid fails. Now click Cancel. The valid doesn't fire
** TestUT.prg
ox = CreateObject("testform")
ox.Show()
Read Events
Define Class testform As form
     Height = 200
     Width = 200
     Add Object Text1 As textbox
     Add Object cmdCancel As commandbutton With ;
          Caption = "Cancel", ;
          Cancel = .T.
     Procedure Init
          *--     center textbox as button
          With this
               .cmdCancel.Left = .Width/2 - .cmdCancel.Width/2
               .cmdCancel.Top = .Height - .cmdCancel.Height - 5
               .Text1.Left = .Width/2 - .Text1.Width/2
               .Text1.Top = .Height/2 - .Text1.Height/2
          EndWith
     EndProc
     Procedure Destroy
          Clear Events
     EndProc
     Procedure Text1.Valid
          If LastKey() <> 27
               Return !"-" $ this.Value
          EndIf
     EndProc
     Procedure cmdCancel.Click
          thisform.Release()
     EndProc
EndDefine
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