How To Use the Wizard txtbtns Class in a Non-Wizard Form (139597)



The information in this article applies to:

  • Microsoft Visual FoxPro 8.0
  • Microsoft Visual FoxPro for Windows 7.0
  • Microsoft Visual FoxPro for Windows 6.0
  • Microsoft Visual FoxPro for Windows 5.0
  • Microsoft Visual FoxPro for Macintosh 3.0b
  • Microsoft Visual FoxPro for Windows 3.0

This article was previously published under Q139597

SUMMARY

The Form wizard can create a fully functional data entry form for any table. The form generated by this wizard contains a standard button bar that provides navigation, editing, end searching functionality. It is possible to also use this button bar in forms not created by the Form wizard.

MORE INFORMATION

To use the wizard button bar in a form not created by the Form Wizard, create a new visual class library to be used separately from the Wizstyle.vcx visual class library. To do this, either subclass the txtbtns class in the Wizstyle.vcx visual class library, or create a new visual class library using the ADD CLASS command.

If the new class is created by subclassing the txtbtns class in the Wizstyle.vcx visual class library, it will inherit any future changes that are made to the txtbtns class. However, if the new class is created using the ADD CLASS command, it will not be affected by any future changes made to the txtbtns class in the Wizstyle.vcx visual class library.

Once the new class has been created, it can be added to a form.

Subclassing the Txtbtns Class

  1. Type the following in the Command window to create a new class:
          CREATE CLASS
    							
  2. Type txtbtns in the Class Name box.
  3. Click the three-dot button next to the Based On box, and then select the txtbtns class in the Wizstyle.vcx visual class library.

    NOTE: The Wizstyle.vcx visual class library is located in the Vfp\Wizards directory.
  4. Type Wizbtns.vcx in the Store In box.
  5. Save and close the Class Designer.

Using the ADD CLASS command

To create the new class using the ADD CLASS command, type the following in the Command window:
   ADD CLASS txtbtns OF SYS(2004)+"Wizards\Wizstyle.vcx" TO Wizbtns.vcx
					

Adding the Txtbtns class to a form

  1. Create a new form.
  2. Add a table to the form's data environment.
  3. Drag fields from the form's data environment to the form.
  4. Click the View Classes button in the form controls toolbar.
  5. Click Add, and then select the Wizbtns.vcx visual class library.
  6. Click the Txtbtns button on the form controls toolbar, and then click the form.
  7. Save and run the form.
Note: The txtbtns class relies on the fact that the forms created by the Form wizard use buffering. The new txtbtns class will inherit this same dependency. The default setting of buffering on a form is 0-None. For these buttons to be fully functional, the forms buffering property must be set to either 1-Pessimistic or 2-Optimistic.

Modification Type:MinorLast Reviewed:7/13/2004
Keywords:kbControl kbwizard kbhowto kbOOP KB139597