FIX: Enabled_Assign Fires Incorrectly for Container in Container

ID: Q221730


The information in this article applies to:
  • Microsoft Visual FoxPro for Windows, version 6.0


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 this to be a bug in the Microsoft products 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:

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

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


MORE INFORMATION

Steps to Reproduce Behavior

  1. Type the following in the Command window:


  2. 
    CREATE CLASS basecontainer AS CONTAINER OF test.vcx 
  3. From the Class menu, select Edit Property/Method.


  4. Highlight the Enabled property in the Property/Method information list box.


  5. Click the Assign Method check box and then click the Apply and Close buttons.


  6. Add this code to the Enabled_assign method:


  7. 
    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 
  8. Save and close the class.


  9. Type the following in the Command window:


  10. 
    CREATE CLASS SubCont OF test.vcx AS basecontainer FROM test.vcx 
  11. Save and close the class.


  12. Type the following in the Command window:


  13. 
    CREATE CLASS OtherCont OF test.vcx AS basecontainer FROM test.vcx 
  14. In the Class Designer, add an instance of the SubCont class to the OtherCont container.


  15. Save and close the class.


  16. Create a new form called Test.


  17. Add an instance of the OtherCont class to the form.


  18. Right-click on OtherCont1 and select Edit from the context menu.


  19. Click the SubCont1 container.


  20. Change the Enabled property of SubCont1 to .F. in the Property Window.


  21. Save and run the form.


  22. You should see the message where the enabled_assign method is receiving a non-logical parameter.


  23. Notes: This will also occur with other logical properties such as Visible.

© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Jim Saunders, Microsoft Corporation

Additional query words:

Keywords : kbOOP kbVFp600 kbVFp600bug kbVS600sp3fix kbGrpFox
Version : WINDOWS:6.0
Platform : WINDOWS
Issue type : kbbug


Last Reviewed: June 9, 1999
© 2000 Microsoft Corporation. All rights reserved. Terms of Use.