*  Program...........: BUILDERB (Builder Builder)
*  Author............: Ken R. Levy
*  Copyright.........: (c) Flash Creative Management, Inc., 1995
*                      (c) Ken R. Levy, 1996, 1997

BuilderB requires BuilderB.prg to be executed before executing any
builders based on BuilderB (design time only).

BuilderB for Visual FoxPro 5.0.

To create a new builder for a specific class using BuilderB:

- Suppose you have a DisplayButton class which has a property cMessage and lWait which is used to display a wait window for the contents of cMessage, and wait if lWait is .T.  The steps below show how to create a custom builder for this DisplayButton class.  Suppose this DisplayButton class in is a VCX called Buttons.vcx.

- Run BuilderB.prg from your startup program.  All BuilderB.prg does is append the directory it's in to your SET PATH.

- Add a custom property to DisplayButton called BuilderX.

- Enter the name of the builder to be created in the BuilderX property.  In this case, call the builder DisplayButtonBuilder, so enter the classlib,classname for the BuilderX property.  The BuilderX property should be set to Buttons,DisplayButtonBuilder.  Note:  If the builder class is stored in the same VCX as the class it's used with, the classlib can be skipped (i.e. BuilderX=,DisplayButtonBuilder).

- Save the DisplayButton class with the new changes for the new BuilderX property.

- Create a new class in Buttons.vcx called DisplayButtonBuilder by subclassing the BuilderForm class contained in BuilderB.vcx.

- Right click over the form in the designer and choose Builder to launch the BuilderForm Builder.

- Set the properties for the new builder (i.e. Set the caption to Display Button Builder).

- Note how the builder is modeless, and contains a timer so that if properties are changed in the property sheet, the values in the Builder are automatically refreshed.

- Make any additional settings in the builder, then close the BuilderForm Builder.

- Right click over the pageframe and select Edit.

- From the class toolbar in the class designer, select Add.. and then choose BuilderB.vcx to add the BuilderB classes to the toolbar.

- Add an instance of the BuilderLabel class to the pageframe.

- Right click the label and choose Builder to launch the Caption Builder.

- Set the caption of the label to Message.

- Close the Caption Builder.

- Add an instance of the BuilderTextBox class to the pageframe to the right of the label.

- Right click the textbox and choose Builder to launch the BuilderTextBox Builder.

- Set the property to cMessage so that this textbox will edit the cMessage property.

- Make any additional settings in the builder, then close the BuilderTextBox Builder.

- Add an instance of the BuilderCheckBox class to the pageframe below the label.

- Right click the checkbox and choose Builder to launch the BuilderCheckBox Builder.

- Set the property to lWait so that this textbox will edit the lWait property.

- Set the caption of the checkbox to Wait.

- Make any additional settings in the builder, then close the BuilderCheckBox Builder.

- Close the class designer, saving the new DisplayButtonBuilder in Buttons.vcx.

- Open the form desinger and add an instance of the DisplayButton class to the form.

- Right click the button and choose Builder to launch the Display Button Builder.

- Use the new custom builder to set the cMessage and lWait properties.

- Close the Display Button Builder.

Note:  Pressing the Builder button in the builder form will automatically launch the Visual FoxPro built-in builders using _builder.  If the object being edited has a custom property called Builder and that property is set to a specific APP, SCX, PRG, (ClassLib,Class), etc., then pressing the builder button in the builder form will launch that specific builder.


To create a drag toolbar builder, follow the steps above but instead of subclassing BuilderForm, subclass DragToolbarBuilder.

To view an example of a custom builder, refer to the CaptionBuilder class in BuilderB.vcx

To view several examples of drag toolbar builders, refer to the toolbar classes in Builders.vcx.  You can instantiate the toolbars, then drag the builder button onto any object to link it.
