PRB: Cannot Rename Objects Originally Defined in a ContainerLast reviewed: August 2, 1995Article ID: Q133335 |
The information in this article applies to:
SYMPTOMSWhen an option group class defined in a Visual Class Library (VCX) is placed on a form, each of the names of the option buttons in the option group is read only. However, if a button is added to the group after it is subclassed, the name of the added button can be modified (is read/write).
CAUSEWhen you define a container visual class in a VCX, the method and property settings reference the name of the contained object. For example, the Top property of an option button in an option group is referenced as follows in the class definition:
Option1.Top = 5If the contained object is renamed when an instance is created, any reference in the class definition is lost and the code won't run. Therefore, by design, users are prevented from renaming the contained object to ensure that the code runs as expected. The same behavior applies to member objects of any contained class.
RESOLUTIONIf you need to be able to change the name of an object on the form, create the container class in a VCX with no object members. This way, you can add the objects later, and those added objects will be read/write, so you can control the objects when they are placed on the form. If the contained objects need to have a consistent look, you can create custom builders to add the controls.
STATUSThis behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
|
Additional reference words: 3.00
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |