Microsoft KB Archive/134790

= How to Add Code to Wizard-Generated Command Buttons =

Article ID: 134790

Article Last Modified on 10/15/2003

-

APPLIES TO


 * Microsoft Visual FoxPro 3.0 Standard Edition
 * Microsoft Visual FoxPro 3.0b for Macintosh

-



This article was previously published under Q134790



SUMMARY
You can add code to command buttons created by the Form Wizard and still have the command buttons function properly.



MORE INFORMATION
The command buttons created by the Form Wizard are based on classes defined in the Vfp\Wizards\Wizstyle.vcx visual class library.

All of the command buttons are contained in one of three classes, depending on which style of buttons was used: class Name     Button Style

txtbtns        Horizontal; text verttxtbtns    Vertical; text picbtns        Horizontal; picture Each button is assigned an individual name, following recommended Visual FoxPro naming conventions:

cmdPrev

cmdNext

cmdTop

cmdEnd

cmdFind

cmdPrint

cmdAdd

cmdEdit

cmdDelete

cmdExit

The code for each button is contained in the class definition, not in each button on the form. If method code is entered in an event, such as the click event, which also has code defined in the parent class, the new code will override the parent class code. The parent class code must be explicitly called within the method.

You can add code to the buttons in a generated screen, as long as the code in the parent class is called using the scope resolution operator, as in this example: txtbtns.cmdAdd::Click WAIT WINDOW "I just called the parent click code" If you want the additional code to be processed prior to the default button behavior, place it before the line that calls the parent method. If you want the additional to be processed after the default button behavior, place it after the line that calls the parent method.

Additional query words: VFoxMac VFoxWin

Keywords: KB134790

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.