How to: Add Visual FoxPro Controls to a Form
You can add any of the standard Visual FoxPro controls to your form. For example, you can add labels for fields on the form, add controls such as buttons, edit boxes, or list boxes, or add pictures or lines and shapes to enhance the appearance of your form.
To add a control to a form
Open the form in the Form Designer.
On the Form Controls toolbar, click the control you want to add.
In the Form Designer, click the form at the location you want to place the control at its default size.
The new control appears where you placed it. You can then move it to its final location on the form, and resize it as needed.
You can also click and drag the cursor to draw the control with the dimensions that you want. For more information, see Form Designer.
You can now set properties for the control by clicking Properties on the View menu to open the Properties window. The Properties window displays all the properties for the controls you add to a form. For more information, see Properties Window (Visual FoxPro).
You can add multiple controls of the same type without choosing the control each time you want to add a control.
To add multiple controls to a form
Open the form in the Form Designer.
On the Form Controls toolbar, click the control you want to add.
On the Form Controls toolbar, click Button Lock.
Tip
You can also double-click the control you want to add.
You can now add multiple controls of the same type without clicking the control on the Form Controls toolbar multiple times..
Adding Controls with a Builder
Just as you can use wizards can be used to create forms quickly, you can use a builder to add certain controls to a form. The builder sets the appropriate properties on the control using your answers to a series of questions.
To add a control with a builder
Open the form in the Form Designer.
On the Form Controls toolbar, click Builder Lock.
Add the control you want to the form.
If available, a builder opens for the control.
Follow the instructions on the builder tabs.
Note
To set control properties in the Properties window, turn off the Builder Lock.
For more information choosing controls, see Using Controls. For details on valid image control sources, see Graphics Support in Visual FoxPro.
Adding Data-Bound Controls to a Form
You can bind controls to data in a table, view, table field, or view field.
To bind a control to data in a table, view, or table or view field
- Set the ControlSource property for a control to a field or the RecordSource property of a grid to a table or view.
For more information, see ControlSource Property or RecordSource Property.
You can also create data-bound controls by dragging fields or tables to the form from the following locations:
The type of the control created by dragging a field or table depends on the Field Mappings settings in the Properties tab of the Table Designer or the Field Mapping tab of the Options dialog box.
Tip
You can make it easier to bind new controls to fields in tables or views by placing the tables or views associated with your form in the form's data environment. The ControlSource property in the Properties window displays a list of the fields available in the Data Environment designer so you can select the one you want to bind to a control.
See Also
Tasks
How to: Add Controls to a Form with the Component Gallery
How to: Add Controls to a Wizard-Generated Form
How to: Add User-Defined Objects to a Form
How to: Select, Move, and Resize Form Controls
How to: Set Tab Order for Controls