FIX: Init Event Shows Twice in Event Tracking on Objects Created with AddObject() (300055)



The information in this article applies to:

  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Windows 5.0a
  • Microsoft Visual FoxPro for Windows 6.0

This article was previously published under Q300055

SYMPTOMS

If you use AddObject() in the Init event of a class that adds a container, the Init event for objects in the container appears twice in the event log.

STATUS

This problem was corrected in Visual FoxPro version 7.0 for Windows.

MORE INFORMATION

Steps to Reproduce Behavior

  1. In Visual FoxPro (VFP) 5.0 or 6.0, paste the following code in a new program:
     *!* Q300055 FIX: Init Event Shows Twice In Event Tracking On Objects Created With AddObject()
    SET EVENTLIST TO INIT, DESTROY
    SET EVENTTRACKING TO EventProb.LOG
    SET EVENTTRACKING ON
    
    ox = CREATEOBJECT('EventProb')
    ox = NULL
    
    SET EVENTTRACKING OFF
    SET EVENTTRACKING TO
    MODIFY FILE EventProb.LOG NOWAIT
    
    DEFINE CLASS EventProb AS FORM
    	PROCEDURE INIT
    	THIS.ADDOBJECT('cntProb', 'ProbContainer')
    ENDDEFINE
    
    DEFINE CLASS ProbContainer AS CONTAINER
    	ADD OBJECT txtDemo AS TEXTBOX
    ENDDEFINE
    					
  2. Save and run the code (the name is unimportant). The event log appears on the screen. Note that the Init event for the text box appears in the log twice, on lines 2 and 3.

Modification Type:MajorLast Reviewed:10/16/2002
Keywords:kbBug kbCodeSnippet kbvfp700fix KB300055