General information
Category:
Object Oriented Programming
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only