Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Is there a way to tell...
Message
 
 
To
20/12/2000 17:22:43
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Miscellaneous
Thread ID:
00455656
Message ID:
00455947
Views:
25
Hi John,

This is something I got from in the "Effective Techniques..." book or the "Fundatmentals..." book (I don't remember which) as well as a post on another newsgroup a couple of months ago. This particular piece was put in the Valid event of a textbox control subclass.

LOCAL llRetVal, ;
loObject

llRetVal = .T.

*----------------------------------------
* Over what object is the pointer sitting
*----------------------------------------
loObject = SYS(1270)

*------------------------------------------------------------------
* If the last key pressed us Escape or SHIFTTAB (defined in an include file)
* or a custom property of the object exist and is (in this case)
* true or clicked on the form close skip validation
*
*
* PROBLEM: ShiftTab with invalid data in the control and then click save
* can result in invalid data in the tables. It is up to you
* to have validation (business rules) checking prior to
* the saving.
*------------------------------------------------------------------
IF (INLIST(LASTKEY(), KEY_ESCAPE, KEY_SHIFTTAB) OR ;
(TYPE('loObject.lCancel') = 'L' AND loObject.lCancel) OR ;
(TYPE('ThisForm.ReleaseType') = 'N' AND ThisForm.ReleaseType > 0))

RETURN .T.

ELSE
RETURN This.isValid() && Put validation criteria in a custom method for the control
ENDIF
Previous
Reply
Map
View

Click here to load this message in the networking platform