Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to prevent container to lose focus
Message
De
04/01/2005 19:13:58
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Classes - VCX
Versions des environnements
Visual FoxPro:
VFP 8 SP1
OS:
Windows XP SP2
Divers
Thread ID:
00974182
Message ID:
00974246
Vues:
18
>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
It is horrid, but is the only solution without a coordination with container's member.
ELSE
  Container::setFocus
ENDIF
Fabio
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform