Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
BindEvent( TextBox, 'Valid' )
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00792218
Message ID:
00792231
Vues:
16
Hi Tracy,

It's by design. From BINDEVENT help, "Certain events such as When and Valid require code in the event for it to occur".

>The following code demonstrates a problem I ran across. I'm looking for comments on if you feel this is a bug, or by design. I can see maybe, the event doesn't fire since no code exist to process. There is a workaround, noted in the code as the class ctxtbox, or BindEvent to LostFocus.
>
>So, Does this code correctly identify a bug?
>
>
>oFrm = CREATEOBJECT("cFormTest")
>oFrm.Show()
>READ EVENTS
>
>DEFINE CLASS cFormTest AS Form
>
>AUTOCENTER = .T.
>HEIGHT     = 100
>WIDTH      = 300
>
>ADD OBJECT txtTest1 AS TextBox WITH ;
>    HEIGHT  = 20  ,;
>    LEFT    = 6   ,;
>    TOP     = 6   ,;
>    VISIBLE = .T. ,;
>    WIDTH   = 50
>
>ADD OBJECT txtTest2 AS ctxtbox WITH ;
>    HEIGHT  = 20  ,;
>    LEFT    = 6   ,;
>    TOP     = 26  ,;
>    VISIBLE = .T. ,;
>    WIDTH   = 50
>
>ADD OBJECT cmdClose AS CommandButton WITH ;
>    CANCEL  = .T.     ,;
>    CAPTION = "Close" ,;
>    HEIGHT  = 20      ,;
>    LEFT    = 250     ,;
>    TOP     = 70      ,;
>    VISIBLE = .T.     ,;
>    WIDTH   = 50
>
>PROCEDURE INIT
>   BINDEVENT(ThisForm.txtTest1, "Valid", ThisForm, "ValidTest")
>   BINDEVENT(ThisForm.txtTest2, "Valid", ThisForm, "ValidTest")
>   BINDEVENT(ThisForm.cmdClose, "Click", ThisForm, "CloseMe")
>ENDPROC
>
>PROCEDURE DESTROY
>   CLEAR EVENTS
>ENDPROC
>
>PROCEDURE closeme
>   ThisForm.Release()
>ENDPROC
>
>PROCEDURE validtest
>   AEVENTS(arEvent, 0)
>   WAIT WINDOW NOWAIT "In Form Valid for " ;
>                     + arEvent(1).Name + "." + arEvent(2)
>ENDPROC
>
>ENDDEFINE
>
>DEFINE CLASS ctxtbox AS TextBox
>
>   PROCEDURE VALID
>      * Placing a simple comment here, allows BindEvent to see Event
>   ENDPROC
>
>ENDDEFINE
>
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform