PRB: Cannot Rename Objects Originally Defined in a ContainerID: 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:
If 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 Behavior1. Create a new class by typing CREATE CLASS in the Command window. 2. Name the class, and on the BasedOn menu, click OptionGroup. 3. Save and close the Class.
4. Create a new form. 5. Click the View Classes button on the Form Controls toolbar, and select 6. Add the Visual Class you just created.
7. Drop the option group onto the form. 8. Modify the ButtonCount property to 4. 9. Using the right mouse button, click the button, select edit and inspect Additional reference words: 3.00
KBCategory: kbprg kbprb
KBSubcategory: FxprgGeneral
|
Last Reviewed: August 2, 1995 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |