PRB: Cannot Rename Objects Originally Defined in a Container (133335)
The information in this article applies to:
- Microsoft Visual FoxPro for Windows 3.0
This article was previously published under Q133335 SYMPTOMS
When 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).
CAUSE
When 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 = 5
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.
RESOLUTION
If 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.
STATUS
This behavior is by design.
Modification Type: | Major | Last Reviewed: | 2/15/2000 |
---|
Keywords: | KB133335 |
---|
|