Chapter 2: Overview of Visual FoxPro Features

Visual FoxPro gives you more of everything you've come to expect in a database management system (DBMS) — speed, power, and flexibility. And Visual FoxPro leads you into the next generation by providing object and event models that help you create and modify applications faster than ever before.

This section is meant to walk you through some of the major features in Visual FoxPro. For information on the newest enhancements in Visual FoxPro 6.0, see What's New in Visual FoxPro.

This chapter discusses:

Summary of Features

Visual FoxPro brings you expanded capabilities to help you in every area of application and database development. You can see improvements in performance, system resource use, and design environment. For information about changes to the language, see New and Enhanced Language Elements.

Enhanced Project and Database Management

In this version, you have greater control over your projects and databases. You can use source code control products, such as Microsoft Visual SourceSafe™, and see the status of components in the Project Manager. You can also manage project events through the ProjectHook class provided when you issue CREATE CLASS, CREATEOBJECT( ) or NEWOBJECT( ) commands, or use the Application Builder. The database container allows several users to simultaneously create and modify objects within the same database. An on-demand refresh feature lets you update your view of a database or project. Find and Arrange features in the Database Designer allow you to quickly change your view of the objects in your database. Also, keyboard accessibility is available in the Project Manager and icons in the Project Manager, and Database Designer help you to identify objects quickly.

The engine now supports changes to values that violate rules. Pessimistic buffering handles record locking more efficiently. NULL is a recognized keyword and can be used in place of “.NULL.”

Easier Application Development

Visual FoxPro adds a new Application Wizard that provides the new ProjectHook class and Enhanced Application Framework features to make your applications more effective, but we also added features to enhance the development experience and to make it easier to add effective functionality to your applications.

Improved Debugging Tools

You can debug and monitor your application components more easily in this version of Visual FoxPro. You have the option of opening the debugging tools inside the main Visual FoxPro window where they can be displayed along with your application interface, or in a separate window so they don't interfere with your application work space. The debugger offers tools for setting breakpoints, tracking events, and logging execution code, and is similar in appearance to the Visual C debugging environment. In the Watch window and the Locals window, you can drill down to see the property settings or objects and the values of array elements. To see the current value of a variable, you just place your cursor over the variable name in the Trace window. The Output window gives you a convenient way to display interactive or coded information requests and direct the results to a window apart from the application window.

This version of Visual FoxPro also includes an enhanced Coverage Profiler Application that you can use to analyze programs, applications, or projects for code that is actually run. The Coverage Profiler engine itself is customizable as is the interface provided in Visual FoxPro.

Easier Table Design and Expanded Data Dictionary

In this version of the Table Designer, you can easily add indexes as you create fields and specify a greater variety of defaults that make designing forms faster and easier. You can define a regular index on the same tab and row where you specify a field. A Table tab gives you direct access to the table-level validation rules, triggers and statistics. The default class and library properties allow you to assign a control type to a field: when you add the field to a form, you create the exact control you want in one easy step. In addition, InputMask and Format properties help you control how your data is displayed.

A Connection Designer works seamlessly with the ODBC Administrator to make connection creation easier. The designer also provides additional properties for optimizing connections.

Enhanced Query and View Design

You can now create outer joins, specify aliases for columns, or select the top number or percentage of records, right in the Query and View Designers. Also, using the View Designer, you can specify the same extended properties on view fields that you can on table fields. For example, you can specify a default control class, input mask, or format.

Increased Form Functionality and Easier Design

Along with enhancements to the data dictionary that help with form design, the Form Designer itself is easier to use and offers more functionality. The Form Designer supports Single Document Interface (SDI) as well as Multiple Document Interface (MDI) options so your application can function exactly the way you want. Using SDI, you can create application windows that are children of the Windows desktop. A Shortcut Menu Designer helps you create shortcut menus you can use in a control's RightClick event. Forms and controls have additional properties and methods to help you control the look and feel of each part of your form. For a list of properties and methods, see Help.

You can select a group of controls and see common properties, or change them, in the Properties window. If you need more space to view or alter property settings, you can use the Property Zoom feature. Horizontal and vertical centering, and other placement, is easy too, with the alignment tools. Keyboard navigation, a common request for many developers, is available in the Properties window, and lets you move from object to object using the CTRL key in conjunction with the PAGE UP, PAGE DOWN, HOME, or END keys. If you need to change something in a running form, the Design button on the toolbar gives you quick access to design mode again.

The editor makes coding easier with options to format programs, color coding, and enhanced Find and Replace features. Shortcut menus and keyboard accessibility are available throughout the product: use the right mouse button to explore the actions possible for any given element.

More and Better Wizards

Two wizards help you to create applications:

Updates to other wizards and samples give you added capabilities, such as accessing index tags for sorting. The Form Wizard allows you to add a page frame to display more fields on additional pages. The PivotTable Wizard can use Open Database Connectivity (ODBC) to populate a pivot table. The SQL Server Upsizing Wizard supports declarative referential integrity. The Cross-Tab Wizard now supports displaying null values. In addition, a wizard provided as a utility lets you create Web pages for querying and displaying your database records.

Tighter OLE and ActiveX Integration

Visual FoxPro is an Automation server, so other applications can tap into the power of Visual FoxPro. ISimpleFrame capabilities extend support for a wider variety of ActiveX controls. Visual FoxPro also provides the capability to create your own Automation servers that you can deploy locally or remotely.

Practical Samples of Application Components

Solutions sample, located in the Visual Studio …\Samples\Vfp98\Solution directory, is a collection of application components that show how you can use the features of Visual FoxPro to solve real-world challenges. You can use the sample components and their code directly in your applications. For more information about Visual FoxPro samples, see Explore the samples.

Creating Applications Rapidly

You can develop applications rapidly with help from Visual FoxPro wizards, builders, toolbars, and designers. And, with the Visual FoxPro object and event model, you can create prototypes and implement applications quickly.

Getting Quick Results with Wizards and Builders

Using wizards and builders, you can have all or any component of your application completed in a matter of minutes. Plus, if any component you create with a wizard or builder does not fully meet your needs, you can alter the component using a designer.

Creating an Application Now

For quick results, wizards are the answer. They provide step-by-step prompts for common tasks you perform in Visual FoxPro. For example, the Table Wizard guides you through the process of creating a table, the Form Wizard creates a form, and the World Wide Web Search Page utility helps you create a Web page that searches your tables.

Take a look at what you can do:

If you are in a hurry, use the table in Wizards Overview to select a wizard, and begin creating your application or component.

If you do not want to experiment with your own data and application components, use the samples provided with Visual FoxPro. You can work in the sample database Testdata.dbc, located in the Visual Studio …\Samples\Vfp98\Data directory.

The Table Wizard helps you create tables faster.

For details about wizards that are new or enhanced in this version, see New and Enhanced Wizards.

Taking Shortcuts with Toolbars

Like other Microsoft applications, Visual FoxPro includes toolbars containing buttons that represent common tasks you perform or objects you use frequently. To perform a specific task or use a particular object, choose the appropriate button.

The Standard toolbar collects common functionality in one place.

You can customize the toolbars that come with Visual FoxPro. You can also define custom toolbars for the applications you write. For more information about toolbars, see Chapter 3, Configuring Visual FoxPro, or see Chapter 11, Designing Menus and Toolbars, in the Programmer’s Guide.

Building Controls Quickly

Just as wizards can help to create reports and forms, builders are visual tools that help you design controls to your specifications. Builders can save you time when you are setting up many forms or prototyping applications. All you do is start the builder and answer a series of questions. Using your answers, the builder sets properties for the control you are adding.

Builders make it easy to add controls to forms.

Add a Combo Box to Your Form Suppose you want to enhance a simple form you created by adding the ability to select field values from a list, rather than moving through all the records with VCR buttons and viewing the values in a text box. Just replace the current text box with a combo box and use a builder to set the properties.

Modify Existing Controls with a Builder If you want to change an existing control, you can select the control and use a builder to help you set the control's properties.

For example, the Combo Box Builder is a tabbed dialog box that helps you design a combo box on a form. A combo box gives you the same view of a value as a text box control, but allows you to choose from a list like a list box control. With this builder, you can set properties of a combo box. As you set each property, the control on the form changes to match the settings.

The Builder Lock button and Combo Box button

The tabs in the Combo Box Builder dialog box

Build a Grid Control To display a small spreadsheet-like view of your data, you can use a grid control. Even if you aren't familiar with all the properties of a grid control, you can still take advantage of their functionality using a builder. The builder helps you choose the fields for your grid, select a style and layout, and establish relationships between tables bound to the grid control. As you make changes in the builder, they are reflected in the Form Designer.

Visual FoxPro offers a wide selection of builders.

To Use this builder
Format a group of controls AutoFormat Builder
Build a combo box Combo Box Builder
Build a command group Command Group Builder
Build an edit box Edit Box Builder
Create and edit expressions Expression Builder
Build a form Form Builder
Build a grid Grid Builder
Build a list box List Box Builder
Build an option group Option Group Builder
Ensure referential integrity Referential Integrity Builder
Build a text box Text Box Builder

For more information, see Chapter 1, Getting Started, in the User's Guide.

Managing Your Work with the Project Manager

With the Project Manager, you can create and manage everything in an application from a central interface. For example, you can create or update tables and databases, design or change forms and reports, define or change class libraries, and compile or rebuild your applications. In addition, you can access all the wizards, builders, toolbars, and other tools that make Visual FoxPro so easy to use. If you add a source code control product, you can also see if the components are checked out, locked, or shared.

The Project Manager provides a central location for managing your work.

Organize Your Application Components The Project Manager helps you organize your data, whether you are running a query or designing a complete application. With a few clicks of the mouse, you can keep track of your tables and queries, and organize related forms, reports, labels, code, bitmaps, and other files.

To see the Project Manager in action with a sample database, start Visual FoxPro, create a project, and add a database to it. To do this, select Databases, choose Add, and locate Testdata.dbc in the Visual Studio …\Samples\Vfp98\Data directory.

Use the Project Manager to organize your files.

Use a Familiar Interface The Project Manager interface is similar to the Microsoft Windows Explorer interface. Lines connecting the icons show the hierarchy between items in the project. You can expand and collapse the outline view of your project to see the level of detail you need — from databases down to individual fields in a table. You can also assign custom icons to container classes, and access source code control features. Using the keyboard, you can navigate through the Project Manager.

To Do this
Look at different categories of files and objects in your project Choose a tab.
Expand the outline view Click a plus sign.
Collapse the outline Click a minus sign.
Add files to the project Choose Add.
Access build options Choose Build.

Modify or Browse Tables You can set the Project Manager so that double-clicking a file displays the table in the Table Designer, where you can modify the table's structure, or in a Browse window. Choose Options from the Tools menu, and then set the Project double-click action option in the Projects tab.

Set File Descriptions You can track your files more easily by setting the file descriptions that appear in the Project Manager. Select the file, click the right mouse button, and then choose Edit Description.

Dock or Use Tear-Off Tabs To make more space available on your screen, you can collapse the Project Manager, dock it like a toolbar, and tear off the tabs you need to work with.

The Project Manager allows you to customize your workspace.

Work as a Team To control changes to application objects, your team can use a source code control product, such as Microsoft Visual Source Safe. Source code control is managed through the Project Manager. After you enable the source control application in the Options dialog box, you can add your files to the source control project using the source code options on the Project menu. As you add and modify files, the Project Manager tabs display icons next to the files to indicate each file's status.

Try organizing your own tables, databases, queries, and reports in the Project Manager, or use the Project Manager to track the components of an application.

For more information about See
The Project Manager Chapter 1, Getting Started, in the User's Guide.
Developing applications with the Project Manager Chapter 2, Developing an Application, in the Programmer’s Guide.
Team development Chapter 29, Developing in Teams, in the Programmer’s Guide.

Customizing Your Application Easily with Designers

If you want more control than you get with wizards and builders, use the Visual FoxPro designers. Designers provide a graphical interface through which you can create and customize the components of your application. For example, you can define a form with the Form Designer or design a table with the Table Designer.

The Table Designer gives you complete control over creating tables.

You can start a component using a wizard, and then modify the component using a designer.

To Use this designer
Create tables and set indexes on tables Table Designer
Run queries on local tables Query Designer
Run queries on remote data sources; create updatable queries View Designer
Create a form for viewing and editing data in you tables Form Designer
Create a report for displaying and printing your data Report Designer
Create a label layout for printing labels Label Designer
Set up a database; view and create relationships between tables Database Designer
Create a connection for remote views Connection Designer
Create a menu bar or shortcut menu Menu Designer

For more information, see Chapter 1, Getting Started, in the User's Guide.

Designing a Database

Now with Visual FoxPro, it’s easy to create a relational database. You can quickly define a set of tables and link them with relationships that persist whenever you use the tables.

Take a look at the sample database. To open the database in the Database Designer, choose Open from the File menu, and locate Testdata.dbc in the Visual Studio …\Samples\Vfp98\Data directory.

The Database Designer shows the relationships between tables.

Getting the Most Out of a Database

Using the Visual FoxPro database features, you can:

Create and Edit Relationships Relationships are easy to define and edit in the Database Designer.

Double-click a relationship line to edit the relationship between two tables.

Enforce Data Integrity Tables in a database have additional properties that let you validate data and use rules and triggers to control data entry.

Make Data Entry More Efficient Set table properties to control default values, identify default control type, and specify descriptive captions for your fields.

Pass Parameters to Remote Stored Procedures If you are comfortable using code to do your work, you can now pass parameters by reference to a stored procedure on a back-end server, as well as obtain return values from the stored procedure. Input/output parameters are available only when using SQL pass-through; they cannot be used in views. If you use input/output parameters in views, they will be treated as input parameters.

Working with Database Objects

The Database Designer provides a graphical interface for manipulating your database objects such as tables, local views, and remote views.

Identify Tables and Views Easily In the database layout, you can quickly identify local views and remote views by the icons displayed in the title window for each object.

Locate Database Objects Quickly If your layout is crowded, you can still locate database objects quickly using the Find Object option on the Database menu.

Make Connections from the Toolbar You can now create connections to ODBC data sources from the Database Designer toolbar.

Customize Your Database Layout You can show or hide database objects using the Properties option. You can also arrange objects by name and type, or align objects horizontally and vertically using the Arrange option. If your tables are different sizes and widths, you can clean up the layout by resizing objects to the default height and width using the Arrange option.

Explore the common tasks for creating and maintaining a database.

To Do this
Add a table to a database Drag the table from the Project Manager or choose the Add Table button.
Remove a table from a database Select a table and choose Remove Table.
Create a persistent relationship Drag from the primary or candidate index in a table to the index of another table.
Set properties for a database table Select a table and choose Modify from the Database menu to display the Table Designer.
Collapse the view to see more tables Select Database Designer and choose Collapse All from the shortcut menu.
Rearrange the tables Drag tables by their names.
Use Arrange on the Database menu.
Build referential integrity Use the Referential Integrity Builder.

Build Referential Integrity The Referential Integrity Builder handles setting up referential integrity code to cascade changes into a child table, thereby preventing “orphan” records. To try it, just double-click the join line between two tables in a database and choose the Referential Integrity option in the Edit Relationship dialog box.

The Referential Integrity Builder helps you control data consistency.

For more information about See
Creating and joining tables or setting indexes for tables Chapter 2, Creating Tables and Indexes, in the User's Guide
Setting up databases Chapter 3, Collecting Tables into a Database, in the User's Guide
Setting database table properties and referential integrity Chapter 7, Working with Tables, in the Programmer’s Guide

Creating Tables and Indexes

In Visual FoxPro, creating tables is easy using the Table Designer. The designer's three tabs provide you with all the options you need to define fields, specify indexes, and view table information.

The Table Designer creates Database Tables or Free Tables.

Using the Visual FoxPro Table Designer, you can:

Create a Database or Free Table Make a table in a database with additional properties and relationships to other tables, or make a free table that doesn't need extended properties or relationships.

Modify an Existing Table Select the table in the Project Manager and choose Modify to display the table in the Table Designer.

Create an Index to Order Data Add a regular index while creating a field or choose the Index tab in the Table Designer.

Enter Data Easily After you create your table, you can display and edit data in a Browse window and add data. For easier data entry, put the Browse window into Edit mode by choosing Edit from the View menu, and then put the table into Append Mode.

Using the Properties of a Database Table

By adding your tables to a database, you increase your ability to manage how your data is displayed or entered into fields.

Set a Default Value for a Field It's easy to set default values that appear in a field whenever you add a record to a table.

Save Time on Forms While defining a field, you can set a default class for each field so that when you drag the field onto a form, it automatically becomes the exact class of control you wanted to represent the data. After creating the table, you can drag its fields from the Data Environment Designer, the Database Designer, or the Project Manager onto a form to create the control.

Leveraging Your Legacy Data

You don't have to start with data to start a database and tables.

Convert Existing Tables If you have existing files from previous versions of FoxPro, just open them and the Visual FoxPro Conversion dialog box appears.

Move Other Sources into a Visual FoxPro Table If you have data in spreadsheets or text files, you can import the data into Visual FoxPro tables so that you don't have to retype it. The Import Wizard converts the source file into a Visual FoxPro table, and lets you set column titles, data types, and other options so you can use the resulting table directly in your databases or applications.

For more information about See
Any wizard Pressing F1 from any wizard you use.
The Table Designer Table Designer.
Browsing tables and
setting indexes for tables
Chapter 2, Creating Tables and Indexes, in the User's Guide.
Importing data Chapter 9, Importing and Exporting Data, in the User's Guide.

Creating Queries

It's easier than ever to set up a query to retrieve the information you need using the Query Designer. Under every query lies a SQL SELECT statement; however, you don't need to know SQL to create a Visual FoxPro query. Just use the tabs in the Query Designer to define the clauses of your statement.

Use the Query Designer to define your SQL SELECT Statement.

Using the Visual FoxPro query design features, you can:

Set Up a Two-Table Query Add two sample tables from Testdata.dbc, or use your own .dbf files to explore the Query Designer.

Change Query Output Destinations Choose the Query Destination button on the Query toolbar to choose from a variety of destinations for your query output.

Query destinations allow a variety of ways to use results.

Use Expanded Record Selection Functionality You can now use SQL functionality for Top N and ANSI-standard joins, including left-outer joins, right-outer joins, full-outer joins, and so on. This functionality is supported via the SELECT - SQL command, the Query Designer, and the Query Wizard.

Preview SQL Select Statements If you are familiar with SQL, you might find it useful to preview the SQL select statement the Query Designer builds based on your choices. Choose the SQL button to show the SQL window.

The SQL Statement window shows the code that defines your query.

For more information about See
Designing queries,
query expressions, and
choosing query destinations
Chapter 4, Retrieving Data, in the User's Guide.

Creating Views

Have you ever wanted to select a set of records from two different tables and have the changes you make to the records fed back to the original tables? Now you can, with the View Designer.

Views can display records and allow updates to your source tables.

Using the Visual FoxPro view design features, you can:

Update Data Through a View Try creating a view like the example in the following paragraphs. The view in the example uses the Orders and Orditems tables from Testdata.dbc. This view selects orders made between two dates.

You can make the view updatable with the options on the Update Criteria tab in the View Designer and display the results in a Browse window. Updates you make in the view results are sent back to the two source tables.

Updates can be enabled for some or all fields in a view.

Use View Wizards Two different view wizards can help you set up local and remote views. You can use the Remote View Wizard if you have a remote server (such as Microsoft SQL Server) that you can connect to.

Set Up a View that Prompts for Values You can even set up a view that prompts you for values when you run it. For example, try setting up a view that prompts you for a range of order dates.

Views can prompt for parameters.

Work with Offline Data If you need to work with your data while disconnected from the host data source, you can use the language to create a view and work with offline data, and then return the data to update the host data source.

For more information about See
View Wizards Help by pressing F1 from the wizard.
Creating views Chapter 5, Updating Data with Views, in the User's Guide.
Remote views or
working off line
Chapter 8, Creating Views, in the Programmer’s Guide.

Creating Interfaces without Programming

Visual FoxPro provides powerful controls that you add with the Form Designer, giving you interfaces that require little or no coding. For example, the grid control, linked to one of your tables, makes developing one-to-many forms easy. Just drag 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 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 or 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 Your Form a Professional Look

Be creative and customize your forms with layout, 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 and InputMask properties 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, 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 To collect the actual value of the selected item in the control, you can set the BoundTo property to True. To collect the item's list index number, set the BoundTo property to False.

Select More Than 60 Items in a List Box You can now 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 in the Class Info dialog box.

For more information about See
Creating forms Chapter 8, Managing Data Through Forms, in the User's Guide.
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
Chapter 10, Using Controls, in the Programmer’s Guide.
Using forms in applications Chapter 9, Creating Forms, in the Programmer’s Guide.

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 of the 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 Property 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 Form Designer or Form Controls Toolbar.
Creating forms Chapter 8, Managing Data Through Forms, in the User's Guide.

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 Studio …\Samples\Vfp98\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 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 their 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, 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 Chapter 9, Creating Forms, in the Programmer’s Guide.
Creating classes and using class libraries Chapter 3, Object-Oriented Programming, in the Programmer’s Guide.

Creating a Menu Bar and Shortcut Menus

You can use the Menu Designer to add a menu bar and menus to forms in your application. With the Shortcut Designer, you can create shortcut menus and menus for SDI forms.

When you create a menu, you have the option to add a menu to the menu bar or create 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
Report Wizards Help by pressing F1 from the wizard.
Report Designer Chapter 7, Designing Reports and Labels, in the User's Guide.

Providing a Help System

You can add value to your application by creating a Help system. Using the Help compiler included with Visual FoxPro, you can turn your document files into a graphical Help system to distribute with your applications. If you prefer to use a Visual FoxPro table to store your help information, you can create .DBF-style help. You can find a sample, Ttrade.dbf, in the Visual Studio …\Samples\Vfp98\Taztrade\Help directory. For more information about creating Winhelp and HTML Help, see Chapter 23, Creating Graphical Help, or Chapter 24, Creating .DBF-Style Help, in the Programmer’s Guide.

Taking Advantage of More Power

Visual FoxPro is much more powerful than its predecessors. Object-oriented programming speeds up application development through features such as subclassing. The Visual FoxPro event model eliminates the need to use foundation READ or write event handlers. Optimizing your system settings and implementing Rushmore technology improves the performance of Visual FoxPro.

Harnessing the Power of Object-Oriented Programming

Although Visual FoxPro still supports standard procedural programming, it now also provides true object-oriented programming. Using the Visual FoxPro object model, you can employ all the features of object-oriented programming including inheritance, encapsulation, polymorphism, and subclassing. For details about object-oriented programming with Visual FoxPro, see Chapter 3, Object-Oriented Programming, in the Programmer’s Guide.

You can speed up application development by using classes. For example, you can create a basic form, toolbar, or page frame by using the form, toolbar, or page frame base class provided with Visual FoxPro.

Then, you can reuse your code and forms by subclassing the classes you defined. For example, you can subclass the Form base class to create a custom class that automatically gives all the forms in your application the look and feel you want.

The Class Designer helps you create custom classes.

The Visual FoxPro class model gives you extensive control over the objects in your application. You have as much control of the appearance and behavior of objects on forms at runtime as you do in the Form Designer at design time.

With Visual FoxPro, you can create classes visually with the Class Designer or programmatically with the DEFINE CLASS command. For more information, see Chapter 3, Object-Oriented Programming, in the Programmer’s Guide.

Handling Events with Ease

With Visual FoxPro, you can create fully event-driven applications. You can access all standard Windows events, such as mouse movements that permit dragging or dropping objects. You can control events visually through the Properties window or programmatically through the Visual FoxPro language. For more information about the event model, see Chapter 4, Understanding the Event Model, in the Programmer’s Guide.

Testing and Debugging Immediately

Using the debug environment, you can test and debug your code at the same time you design each component of your application and write the code. The Visual FoxPro language has been enhanced to include support for debugging capabilities, collection properties, checking the lock status of files and the current record, Value tips, and more. Also, the debugging tools work independently from the main application and do not interfere with the interface you are trying to test.

Test as You Design The enhanced Visual FoxPro development environment gives you more power to test your component design and code. For example, if you are designing a form, you can click the Run button to run the code. If you want to change something, just click the Design button and make your changes.

Catch Syntax Errors Early The editor now features color-coded editing: you can specify colors for syntax, normal text, variables, comments, and more in the Edit Properties dialog box. If you mistype a command or keyword, you'll know right away because it's the wrong color.

Debug with Power

You can debug and monitor your application components more easily in this version of Visual FoxPro using the Debugger window.

For more information about testing and debugging your application, see Chapter 14, Testing and Debugging Applications. in the Programmer’s Guide.

Optimizing Your System

Visual FoxPro brings you improved performance across all these product areas:

You can also improve performance by enhancing startup speed and optimizing SET commands. For more information about optimizing your system, see Chapter 4, Optimizing Your System. in this book.

Optimizing Applications with Rushmore Technology

You can dramatically improve the performance of queries by using Rushmore technology. Rushmore is an exclusive technology for rapidly selecting sets of records from tables. It can reduce query response times from hours or minutes to seconds. For more information about using the Rushmore technology, see Chapter 15, Optimizing Applications, in the Programmer’s Guide.

Working with Several Developers

If you have several developers working on your applications, you can use Visual FoxPro's ability to allow simultaneous access to database components. Also, for tracking and protecting changes to your source code, you can use source control programs with the Project Manager.

Let Several People Work on Database Objects You can now modify tables and view definitions, without exclusive access to the database. Use the Refresh option on the Database menu – this reloads the database object definition to reflect any changes made by other users.

Use Source Code Control You can use a source code control program such as Microsoft Visual SourceSafe, to coordinate and manage changes to applications you develop in Visual FoxPro. The Project Manager provides access to source code control on the Project menu.

For more information about working with several developers, see Chapter 29, Developing in Teams in the Programmer’s Guide.

Interacting with Other Applications

With Visual FoxPro, you can share data with other applications, such as Microsoft Excel and Word, use objects from other applications, and control other applications using Automation.

Sharing Data with Other Applications

You can take advantage of all the software tools on your desktop with Visual FoxPro.

Use Your FoxPro Data in Other Applications Sharing data with other applications is easy – for example, you can share Visual FoxPro data with Microsoft Excel by using the PivotTable Wizard or with Microsoft Word by using the Mail Merge Wizard.

Display or Store Objects from Other Applications You can include objects from another application by linking or embedding them in tables or in forms. Then, you can edit the objects directly, without leaving Visual FoxPro.

Editing included objects is easy in Visual FoxPro.

For details about sharing data, see Chapter 10, Sharing Information with Other Applications, in the User's Guide.

Importing and Exporting Data

You can import and export data between Visual FoxPro and many other applications using a variety of file formats: text, spreadsheets, and tables, to name a few. The data can be appended to or copied from existing tables easily. The Import Wizard helps you make decisions about the structure you want the data to take in Visual FoxPro.

For more information, see Chapter 9, Importing and Exporting Data, in the User's Guide.

Integrating with Automation

With Visual FoxPro, you have the power to fully integrate your application with other applications.

Control Other Applications You can extend the power of your application by controlling other applications programmatically. For example, you can direct Microsoft Excel to perform some calculations, instruct Microsoft Graph to chart the results, and then store the chart in a General field of a Visual FoxPro table, all from Visual FoxPro code. Or, you can add ActiveX controls that you or someone else developed.

Optimize Automation Requests You can determine how long your system uses on requests and when messages appear for your user. For example, you can control how much time your system spends retrying Automation requests before displaying a “server busy” message.

You can also control the number of milliseconds that pass between user input while an Automation request is pending, such as using the mouse or keyboard, and a “busy” message appearing.

Control Visual FoxPro from Other Applications Using Visual FoxPro as an Automation server, you can create references to Visual FoxPro objects, execute Visual FoxPro commands, and run Visual FoxPro programs from other applications.

For more information on Automation, see Chapter 16, Adding OLE, in the Programmer’s Guide.

Developing Client/Server Solutions

You can use Visual FoxPro as a front end for developing robust client/server applications. Visual FoxPro combines the higher-level support of updatable views of server data with direct access to native server syntax, using SQL pass-through. This gives you a solid foundation on which to build versatile client/server solutions. A full-featured data dictionary, local and remote views, null support, transactions, international application support, and access to any ODBC data source all contribute to the features you need for client/server development.

Increasing Client/Server Performance

You can increase the performance of your client/server application using the properties and ODBC driver provided in Visual FoxPro.

Controlling Performance with Properties

You can increase performance by using the following cursor and remote view properties:

You can display these properties using the DBGETPROP( ) and CURSORGETPROP( ) functions, or set the properties with the DBSETPROP( ) and CURSORSETPROP( ) functions.

Include or Exclude Memo Fields in Update Detection You can use the CompareMemo property to control when memo fields are used to detect update conflicts. This view and cursor property determines whether memo fields (types M or G) are included in the update WHERE clause. The default setting, true (.T.), means that memo fields are included in the WHERE clause. If you set this property to false (.F.), memo fields don't participate in the update WHERE clause, regardless of the settings of UpdateType.

Optimistic conflict detection on Memo fields is disabled when CompareMemo is set to false (.F.). For conflict detection on memo values, CompareMemo should be set to true (.T.).

Fine Tune Record Fetching Use the FetchAsNeeded property to specify if all rows are fetched progressively or only those within the row set determined by the FetchSize property. If you want to fetch all of the rows in the result set using the Visual FoxPro idle loop, use the default setting, False (.F.). If you want to fetch only when the user scrolls beyond the row set determined by the FetchSize property, set FetchAsNeeded to True (.T.) to fetch the next row set.

Speed Up Re-query Operations on Parameterized Views Using the Prepared property, you can set whether the query for the view is prepared before it is executed. If you set this property to true (.T.), Visual FoxPro sends a request to the ODBC driver to prepare, or compile, the SQL query that defines the view. If the ODBC driver for your back-end data source supports the use of prepared statements, subsequent re-queries on the open view are executed faster.

Using ODBC for Quick Access to Visual FoxPro Data

The Visual FoxPro ODBC Driver provides quick access to Visual FoxPro data. End users and developers of many applications, including Microsoft Access, Microsoft Excel, Visual C++, and Visual Basic, can use this driver to retrieve, manipulate and update Visual FoxPro data. For more information about the Visual FoxPro ODBC Driver, see the Drvvfp.hlp file.

Defining Rules with the Data Dictionary

Visual FoxPro databases (.dbc files) provide a data dictionary that allows you to add rules, views, triggers, persistent relationships, and connections to every table in a database.

Within a database, you can define:

In addition, you can enforce referential integrity for every persistent relationship by using the Referential Integrity Builder to define rules for inserts, updates, and deletes.

Visual FoxPro also supports null values in tables, greatly improving compatibility and connectivity with other data sources, such as Microsoft Access, Visual Basic, and SQL-based servers. For details about null values, search for “null” and “null values”.

Each Visual FoxPro database is completely user-extensible, with access through language enhancements and the visual designers. For more information about databases and data dictionaries, see Chapter 6, Creating Databases, in the Programmer’s Guide.

View Local, Remote, and Offline Data You can design and test a client/server application on your local computer using data from remote, local, or multiple-table heterogeneous views. Local views use tables on your local computer rather than tables on a remote server and multiple table views use related data from separate tables. You can create parameterized views to minimize the amount of data you download from the server, take the data on the road, or update remote data from your Visual FoxPro application. For more information about views, see Chapter 8, Creating Views, in the Programmer’s Guide.

Manage Shared Access with Transactions You can design your application to provide shared access to data. Shared access involves sharing data among users and restricting access when necessary. Transactions and buffering — pessimistic or optimistic, record-level or table-level — mean less programming for you. Built-in batch processing and detailed control over handling update conflicts simplifies updating data in a multiuser environment. For details about designing your application for shared access, see Chapter 17, Programming for Shared Access, in the Programmer’s Guide.

Develop International Applications Visual FoxPro provides several areas of support for developing international applications. For example, Visual FoxPro supports several code pages. The code pages for Greek and Russian are supported on MS-DOS, Microsoft Windows, and Macintosh platforms. Visual FoxPro also supports double-byte character sets for languages such as Japanese, Korean, Traditional Chinese, and Simplified Chinese. In addition, Visual FoxPro supports collation sequences for languages such as Japanese, German, Traditional Chinese, and Icelandic. For more information about international applications, see Chapter 18, Developing International Applications, in the Programmer’s Guide.

Implement a Client/Server Application In addition to using views for client/server development, you can send any native server syntax you want directly to a server with Visual FoxPro SQL pass-through functions. These functions permit additional server access and control beyond the capability of views. For details about SQL pass-through, see Chapter 21, Implementing a Client/Server Application, in the Programmer’s Guide.

After designing your application locally, you can upsize and implement it against a back-end data source. Upsizing applies the benefits of client/server architecture to the local application and allows you to create a remote server database with the same table structure and data as the original Visual FoxPro tables. When you upsize, you choose which tables move to the server and which remain locally for more immediate access. For details about upsizing, see Chapter 20, Upsizing Visual FoxPro Databases, in the Programmer’s Guide.

Upgrading from Earlier Versions

Visual FoxPro protects your investment in applications built in previous versions of FoxPro. In Visual FoxPro, you can run FoxPro applications without changing them. You can change applications using the Visual FoxPro language — knowing that extensions to the language don't affect backward compatibility. You can also convert FoxPro screens, projects, and reports to Visual FoxPro format.

If you choose to convert your FoxPro files to the Visual FoxPro format, you can take advantage of the unique features of Visual FoxPro.

For more information about See
Version differences Differences Between Visual FoxPro and Previous Versions
Upgrading from earlier versions of FoxPro Converting From Previous Versions of FoxPro
Switching from dBASE Switching from dBASE