Microsoft KB Archive/221730

= FIX: Enabled_Assign Fires Incorrectly for Container in Container =

Article ID: 221730

Article Last Modified on 10/15/2002

-

APPLIES TO


 * Microsoft Visual FoxPro 6.0 Professional Edition

-



This article was previously published under Q221730



SYMPTOMS
You have a container class that contains an Assign method for the Enabled or some other logical property. You create another container class based on this original container class. You create a third container class based on the original container. This third container class also contains an instance of the second container class. If you add an instance of the third container class to a form, and toggle the value of logical property in the member container, the parameter passed to the Assign method for the member container will be of numeric rather than logical data type.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3.

For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed



Steps to Reproduce Behavior
  Type the following in the Command window: CREATE CLASS basecontainer AS CONTAINER OF test.vcx  From the Class menu, select Edit Property/Method. Highlight the Enabled property in the Property/Method information list box. Click the Assign Method check box and then click the Apply and Close buttons.  Add this code to the Enabled_assign method: LPARAMETERS lNewVal THIS.Enabled = m.lNewVal IF VARTYPE( m.lNewVal) # "L" MESSAGEBOX( "Enabled_Assign was passed a non-logical value." ;      + chr(13) + "The value passed was "+trans(m.lNewVal)) ENDIF  Save and close the class.</li>  Type the following in the Command window: CREATE CLASS SubCont OF test.vcx AS basecontainer FROM test.vcx </li> Save and close the class.</li>  Type the following in the Command window: CREATE CLASS OtherCont OF test.vcx AS basecontainer FROM test.vcx </li> In the Class Designer, add an instance of the SubCont class to the OtherCont container.</li> Save and close the class.</li> Create a new form called Test.</li> Add an instance of the OtherCont class to the form.</li> Right-click on OtherCont1 and select Edit from the context menu.</li> Click the SubCont1 container.</li> Change the Enabled property of SubCont1 to .F. in the Property Window.</li> Save and run the form.</li> You should see the message where the enabled_assign method is receiving a non-logical parameter. Notes: This will also occur with other logical properties such as Visible.</li></ol>

Keywords: kbbug kbfix kboop kbvs600sp3fix KB221730

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.