User Interface Creation without Programming
Visual FoxPro provides powerful data and user interface controls that you can add to forms using the Form Designer, which makes it possible for you to create a user interface with little or no coding. For example, you can develop one-to-many forms easily by linking a grid control to a table, which you can do by dragging a table onto a form to create the grid control. For consistency with other applications you can also create tabbed dialog boxes or your own builder interfaces with the page frame control.
Creating a One-to-Many Form
Visual FoxPro makes it easy to set up forms to display records from related tables. Using the Project Manager Window and the Form Designer you can just "drag and drop" the fields you need to set up a form.
One-to-many forms display data from related tables.
Try setting up a one-to-many form using two related tables, such as the Customers and Orders tables from Testdata.dbc.
After four steps, one-to-many forms are...
...ready to run.
Specify Tables and Views for Your Form in the Data Environment You can use the data environment for your form or a report to specify the tables or views used by your form. After you have added the tables and views that have the records you want to display in your form, you can drag the fields to the Form Designer.
Create Grids by Selecting Multiple Fields You can select multiple fields and drag them to a form to create a grid object. If you select multiple fields and drag them with the right mouse button, you can choose between a grid and multiple controls. You can also click the Fields item in a table and drag it onto a form to create a grid incorporating all fields in the table. If you right-click a single field and drag it onto a form, you can create a different object class than the one that is assigned as the default object class.
Giving Forms a Professional Look
You can be creative and customize the layout of forms and add colors, shapes, and graphics.
Align controls exactly Use the Layout toolbar to quickly line up controls and space them evenly on the form.
Change the background color Use the Color Palette toolbar.
Add graphics and pictures Use the Line, Shape, and Image buttons on the Form Controls toolbar.
Control Display and Data Entry in a Combo Box You can set the Format Property and InputMask Property for a Combo Box control.
Remove a Border on a Combo Box or Spinner You can use the BorderStyle Property to remove a border from the control. For example, if you are using combo box or spinner controls in a grid, you can clean up the display by removing the extra lines the border adds to the grid.
Use Current Windows Colors for Form Colors You can set an additional option on the ColorSource Property that lets you set the form colors based on the current Windows color scheme.
Setting the Properties on Controls
You can enhance your user interface with the control properties in Visual FoxPro. Using the Properties Window (Visual FoxPro) you can see and set the properties associated with each object in your form to determine how a form control looks and behaves.
Use Data Binding with ActiveX Controls To bind data to ActiveX controls you can use the ControlSource Property (if the control supports it) in the Properties window to specify a field or variable to which the control is bound.
Control Navigation in Page Frames By setting the tab order on your page frame you can control the order that pages are displayed. This also adds the ability to navigate to the different pages in a page frame with the right and left arrow keys.
Control Item Selection in List Box and Combo Box Controls When a list box or combo box is bound to a numeric ControlSource, the list index number of the item is collected, rather than the value. To collect the actual value of the selected item in the control, set the BoundTo Property to True.
Select More Than 60 Items in a List Box You can select an unlimited number of multiple items in a ListBox Control.
Create Hidden Properties and Methods You can set accessibility properties on the properties and methods you create to Public, Protected, or Hidden. To change the accessibility of properties and methods, use the Members Tab, Class Info Dialog Box.
For more information about |
See |
---|---|
Creating forms |
|
Using form wizards |
Help by pressing F1 from the wizard. |
Using builders |
Help by pressing F1 from the builder. |
Using controls |
Help by searching on the control name or Using Controls |
Using forms in applications |
Customizing Your Form Designer
To make your work easier, you can customize the Form Designer to match your work style and needs.
Save Changes Automatically You can set options so Visual FoxPro saves your forms automatically when you quit the Form Designer. In the Forms Tab, Options Dialog Box you can choose the option to Save Changes Before Running Form. If you select this option, you skip the confirmation dialog box, and the changes you made to the current form are saved automatically.
Change the Font in the Properties Window You can choose one of three font settings from the Properties window shortcut menu.
Use the Keyboard in the Properties Window The Properties window supports keyboard navigation for scrolling through the hierarchy of objects, controls, and tab orders. Use CTRL+PGUP and CTRL+PGDN to move up and down through the list.
For more information about |
See |
---|---|
The Form Designer and form controls |
|
Creating forms |
Add Controls from a Class Library
When you need to add controls to a form so you can navigate through the records in it, you can choose from a library of controls, drag in the controls you need, and run the form. It's that simple.
Adding VCR Controls to a One-to-Many Form
You can use the following example to see how easy it is to streamline your work using controls from class libraries.
Store complicated control sets in a class library for reuse.
Add VCR Controls to a Form By opening the sample button class library (Buttons.vcx) supplied with Visual FoxPro, you can easily add a set of VCR-style navigation control buttons to your form. The sample libraries are in the Visual FoxPro ...\Samples\Classes directory.
A class for VCR controls can be added to your toolbar.
Controls are easy to add to your form.
Set the SkipTable Property Because this is a one-to-many form, you need to specify that the next record in the main table is selected when you choose the Next button. To do this, open the Properties Window (Visual FoxPro) and set the SkipTable property so that it refers to the main table.
The SkipTable property adds the final functionality to your control.
Expanding Your Class Libraries
You don't have to wait for someone else to sell you control classes and libraries; you can make your own.
Create Your Own Classes You can create your own controls and save them in class libraries. You can start with standard Visual FoxPro classes and customize them to create your own version, or you can create your own classes.
Point to Classes in Compiled Applications You can use the SET CLASSLIB Command to point to a class included in a compiled application.
Add and Keep Classes on the Forms Control Toolbar When you add a class to the Forms Control toolbar, the class remains on the toolbar until you click the View Classes button again and select Standard.
View Detailed Information about Your Classes Using the Class Browser Window, you can view the entire hierarchy of classes and objects in a class library or form.
Create Your Own Subclasses of ActiveX Controls You can create subclasses of all the ActiveX controls shipped with Visual FoxPro.
For more information about |
See |
---|---|
Using the Class Designer |
Help by pressing F1 from the Class Designer. |
Setting properties |
|
Creating classes and using class libraries |
Creating a Menu Bar and Shortcut Menus
You can use the Menu and Shortcut Designers to add a menu bar and menus to forms in your application. With the Menu and Shortcut Designers you can create shortcut menus and menus for SDI forms.
When you create a menu, you have the option of adding a menu to the menu bar or creating a shortcut menu. The Shortcut Designer presents the familiar Menu Designer interface, but allows you to design shortcut menus rather than menu bars and menus.
After you have generated your shortcut menu, you can attach it to any control by running the menu in the control's RightClick Event.
Creating Reports
When it's time to print out important data, you don't want to spend a lot of time formatting reports. That's why Visual FoxPro provides report wizards to streamline the reporting process. With report wizards you can select the data you want from your tables and views, and present it in your choice of professional looking formats.
It's easy to combine information from two different tables in a one-to-many report.
Using the Visual FoxPro report design features, you can:
Use the Preview Button The last screen of a report wizard has a Preview button so you can quickly see if your report is the way you like it. If not, use the Back button in the wizard and make the necessary adjustments.
Use Quick Report for Fast Results If you're setting up your own report in the Report Designer, choose Quick Report from the Report menu to add selected fields from a table to a report.
Use Query or View Results in a Report Want to print out the results of a query? Choose the Report option in the Query Destination Dialog Box. You can send the query results to a pre-formatted report or send the query to a report wizard.
Create a One-To-Many Report The One-To-Many Report Wizard makes it easy to set up a report that shows fields from two tables joined in a one-to-many relationship. For example, try using the wizard to create a report from two related tables in Testdata.dbc.
Report Wizards retrieve records and format the report layout.
Use Other Report Wizards Try using the other report wizards. For simple one-table reports or summary reports with totals, choose Report Wizard.
Use the Report Designer If you want to customize your wizard-generated report further, just open it in the Report Designer and add the enhancements you need.
For more information about |
See |
---|---|
Help by pressing F1 from the wizard. |
|