README.TXT for Sample on the Web
--------------------------------

Sample for using a builder to change the class of an object to new class.

Objective : VFP does not allow for changing the class of an object either at
design time or at run time. In an application if there is a need for creating
a sub-class to add a new feature then there is no way to modify the forms to
point to the new sub-class (or any other class).
This builder would allow for changing from one class (the source) to another
(the target).

Logic used : VFP builders are a powerful development tool that can automate a
lot of tasks. For the above task of changing the parent class a builder is created.
The main logic is a "Add and Delete" concept style of modification. 
1. The logic is to create a new object whose class would be set to the target class. 
2. Then the original class would be looked at to check for non-default PEMs. These
PEMs would then be copied to the target class object. 
3. Then the tabIndex of the source class object would be copied to the target class object. 4. Then the source class object would be deleted and the target class object would be
renamed to use the same name as the source. 
This way except for a change in the class the object remains the same.

(One side effect is that the new object would be stored at the end of the .scx
file)

The builder form would be stored in a class (sbtChangeClass) and would be
generic enough to be reused. The builder would have properties to indicate the
target class and class library. 
There are 2 kinds of interfaces provided. 
1. One can sub-class the sbtChangeclass and change these properties to have a different target class. 
  In this case the properties
sc_TargetClass, sc_TargetLib have to be entered. sc_TargetLib should contain the file name
of the target class library. sc_TargetClass should contain the name of the class.
sl_GetClass should be set to .f.

2. In this way the user gets the choice to choose the library, class name when the builder is called.
  In this case the property
sl_Getclass should be set to .t.  (sc_TargetClass, sc_TargetLib properties are ignored)

The source class setting can be done in the records added to the builder.dbf
by indicating the class for which the builder would be invoked.

Assumptions/notes : 
1. The builder use the class browser to get the class names when a class library is chosen. So the class browser should be installed in the m/c using this approach.
2. If there are PEMs in the source class that do not exist in the target class, they are ignored.
3. User selecting multiple controls and calling the builder is not supported.

Setup :
1. Unzip the files in a new folder.
2. Load VFP and set the default directory to this folder.
3. Make a copy of your builder.dbf found in the wizards directory under the
VFP home directory
4. Then type
        USE (HOME() + "WIZARDS\builder.dbf")
        APPEND FROM AddToBuilder
        USE

Demo :
1. To have a demo of the builder do the above setup.
2. Then do
  MODIFY FORM sample
3. Right click on one of the textbox objects and in the pull down menu select
builders.
4. You should get the dialog to change the class. If you hit OK the class of
the object would be changed. You can verify this by looking at the Class
Property of the object. Also notice that no other PEM (except tabindex) is
changed.
