Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to prevent container to lose focus
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Titre:
How to prevent container to lose focus
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00974182
Message ID:
00974182
Vues:
66
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform