Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to prevent container to lose focus
Message
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Classes - VCX
Title:
How to prevent container to lose focus
Environment versions
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Miscellaneous
Thread ID:
00974182
Message ID:
00974182
Views:
68
Hi everybody,

I have a container class with an ActiveX control inside. I want to be able to validate user's input and stay in the control if the input is invalid. I thought I can use LostFocus event of my container class and NODEFAULT in the LostFocus would prevent me from leaving this control. However, this is not what happening. The focus still goes to the next control in sequence. What should I do?

Here is my code in ValidateDate and LostFocus methods:
*---------------------- Location Section ------------------------
*   Library: 	Aformsaction.vcx
*   Class: 		Cntcalendar  
*   Method: 	ValidateDate() 
*----------------------- Usage Section --------------------------
*)  Description: Validates a passed date
*)

*   Scope:      Public
*   Parameters: 
*$  Usage:      
*$              
*   Returns:  
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/04/2005 - NN 
*		MODIFIED
*----------------------------------------------------------------
LPARAMETERS tdDateToValidate
IF !THISFORM.calendarobj1.IsDescriptionTrue(TTOD(m.tdDateToValidate), "QUEUEABLE DAY")
	=errormsg("Not a queueable day!")
	RETURN .F.
ENDIF

RETURN .T.
*---------------------- Location Section ------------------------
*   Library: 	Aformsaction.vcx
*   Class: 		Cntcalendar  
*   Method: 	Lostfocus() 
*----------------------- Usage Section --------------------------
*)  Description: 
*)

*   Scope:      Public
*   Parameters: 
*$  Usage:      
*$              
*   Returns:  
*--------------------- Maintenance Section ----------------------
*   Change Log:
*       CREATED 	01/04/2005 - NN 
*		MODIFIED
*----------------------------------------------------------------
LOCAL ltDate as datetime
ltDate = CTOT(DTOC(DATE(1900,1,1) - 2 + THIS.DatePicker.DATE) + " 07:00:00 AM")

IF this.ValidateDate(m.ltDate)
   this.SetDates (m.ltDate)
ELSE
   NODEFAULT && prevent leaving focus from this control
endif
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform