Help  |   Contact Us  |   About Us  |   News and Events
Books, conferences, and other information about... Moving to Linux Switching to OOo Building Linux Apps Using Visual FoxPro
Buy      Download      Your Account      Catalog      Support      Conferences      Resources      Fun

1001 Things You Wanted to Know About Visual FoxPro
Table of Contents

Chapter 1: Controlling the VFP Environment

Starting Visual FoxPro
Configuration files
How to specify a config.fpw file
How VFP locates its configuration file
How VFP starts up when no configuration file is found
Including a configuration file in the project
How to suppress a configuration file
How to determine which configuration file is being used
What goes into the configuration file?
Special settings
SET Commands
Giving VFP a path
How VFP looks for files
Setting the default directory
Using the SET PATH command
Where am I?
How to set a path programmatically
Making sure VFP is only started once
Using a 'semaphore' file
Using the Windows API
Combination of semaphore and Windows API
SET Commands and DataSessions
What exactly does "Default DataSession" mean?
So can I have a "public" Datasession?
How can I ensure SET commands apply to a private data session?
Adding code to BeforeOpenTables()
Suppressing auto-open tables
Creating an environment setting class
How do I get rid of the system toolbars?
The system toolbar "Gotcha!"
Can I make use of keyboard macros in VFP?
How can I construct a more complex macro?
What is a "Macro Set"?
What's the difference between a macro and an On Key Label?
How do I create a 'Splash' screen?
How do I run my splash screen?
An alternative to the splash screen
How to wallpaper your desktop
So how can I get the size of the current _Screen area?
Do I really need to create all these bitmaps?
A toolbar 'gotcha!'
Tidying up your development environment
Closing VFP down
What is an On ShutDown procedure?
What triggers an On Shutdown procedure?
What goes into an On Shutdown procedure?

Chapter 2: Functions and Procedures

How shall we proceed?
Parameters (an aside)
By reference, by value?
How do I know what was passed?
How should I position my parameters?
How can I return multiple values from a function?
What about using named parameters?
Passing parameters optionally
Date and time functions
Elapsed time
Date in words
Calculating Age
What date is the second Tuesday in October of ?
Setting up a payment schedule
What date is ten business days from today?
Gotcha! Strict date format and parameterized views
Working with numbers
Converting numbers to strings
Gotcha! calculations that involve money
String functions
Gotcha! string concatenation
Converting between strings and data
Other useful functions
How do I determine if a tag exists?
How do I determine if a string contains at least one alpha character?
How to convert numbers to words
How to extract a specified item from a list
Is there a simple way of encrypting passwords?
Where do you want to GOTO?

Chapter 3: Design, Design and Nothing Else

So why all the fuss about OOP anyway?
So, just what does all this OOP jargon mean?
Classes and Objects
Practical object oriented programming (POOP)
When should you define a class?
So how do you go about designing a class?
This all sounds very good but what does it mean in practice?
How do you go about building your classes?
But does all this design stuff really work in practice?
How does the design actually translate into code?
Working with your classes
How do I get my classes into the form controls toolbar?
While we're at it, how can I identify my custom classes in the toolbar?
But whenever I want white in my bitmaps it shows up gray!
How do I make Visual FoxPro use my classes instead of base classes?
How do I change the caption of the label that VFP adds?
So can I get a browse to show the field name when a caption is set?
User interface design
Perception governs acceptance
Keep your users focussed
Use the right control for the job

Chapter 4: Basic Controls

What do we mean by 'basic'?
Text boxes
Text box label class
Date text box
Incremental search text box
Numeric text box
Handling time
A time entry text box
A time entry composite class
The true time spinner
Blinking labels
The expanding edit box
Calendar combo
Command buttons
Gotcha! Programming the logical controls
Pages and page frames

Chapter 5: Combos and Lists

Combo and list box basics
List and ListItem collections
When do the events fire?
How do I bind my combo and list boxes?
How do I refer to the items in my combo and list boxes?
What is the difference between DisplayValue and Value?
What's the difference between RowSourceTypes "alias" and "fields"?
How do I make my combo and list boxes point to a particular item?
Quickfill combos
How do I add new items to my combo and list boxes?
How do I filter the items displayed in a second combo or list box based on the selection made in the first?
A word about lookup tables
Generic lookup combos and lists
So what if I want to bind my combo to a value that isn't in the list?
How do I disable individual items in a combo or list?
How do I create a list box with check boxes like the one displayed by Visual FoxPro when I select "View Toolbars" from the menu?
A mover list class
What if I need to display hundreds of items in my combo box?

Chapter 6: Grids: The Misunderstood Controls

When do the events fire?
Gotcha! Grid's valid fires before the valid of the current control
What is the difference between ActiveRow and RelativeRow?
ActiveColumn does not really tell you which is the active column
How do I highlight the current grid row?
Keeping a grid from scrolling when the user tabs off the last column
How do I create multiline headers?
Gotcha! Scrolled event does not fire when cursor keys scroll the grid
Using tool tip text instead of multiline headers
How do I change the grid's display order?
How do I control the cursor?
How do I display the last full page of a grid?
How do I use a grid to select one or more rows?
How do I give my multiselect grid incremental search capability?
How do I use DynamicCurrentControl?
How do I filter the contents of a grid?
So what about data entry grids?
How do I add new records to my grid?
How do I handle row level validation in my data entry grid?
How do I delete records in my data entry grid?
How do I add a combo box to my grid?

Chapter 7: Working with Data

Tables in Visual FoxPro
Some basics
How to open the specific table you want to use
How to get the structure of a table
How to compare the structures of two tables?
How to test for the presence of a field in a table
How to check if a table is being used by another user
What is exactly is a cursor?
Indexes in Visual FoxPro
Types of indexes
How to get information about an index
How to test for the existence of an index tag
Using candidate (and primary) keys
What is a "surrogate key"?
Managing user-entered keys
Using indexes with bound tables
How to index mixed data types when creating a compound key
How to index a buffered table
Working with the database container
Using long table names
Using long field names - don't!!!
Using database containers
How to validate a database container
How to pack a database container
Moving a database container
Renaming a database container
Managing referential integrity in Visual FoxPro
Limitations of the generated RI Code
Using compound keys in relationships
What about other RI options?
Using triggers and rules in Visual FoxPro
So what's the practical difference between a 'trigger' and a 'rule'?
Why, when adding a trigger to a table, does VFP sometimes reject it?
Can I temporarily disable a trigger or rule then?
How do I actually create my trigger and rule procedures?
How do I add a trigger to a table?
So when should I use a trigger?
And when should I use a rule?
Must a trigger or rule always refer to a single function?

Chapter 8: Data Buffering and Transactions

Using data buffering
Where are we coming from?
What do we mean by 'buffering' anyway?
What does all this mean when creating data-bound forms?
So just how do I set up buffering in a form?
So what mode of buffering should I use in my forms?
Changing the buffer mode of a table
IsChanged() - another function that FoxPro forgot?
Using TableUpdate() and TableRevert()
Managing the scope of updates
TableUpdate()'s second (force) parameter
Specifying the table to be updated or reverted
How can I handle 'save' and 'undo' functionality generically?
The design of the form class
Using the new form class
Detecting and resolving conflicts
The role of OldVal() and CurVal()
So how do I actually detect conflicts?
OK then, having detected an update conflict, what can I do about it?
Conflict resolution sounds fine in theory, how does it work in practice?
Using transactions
When do I need a transaction?
What effect does rollback have on my data?
How does a transaction impact on FoxPro's locking mechanisms?
Can I use multiple transactions simultaneously?
Some things to watch for when using buffering in applications
Cannot use OLDVAL() to revert a field under table buffering
Gotcha! Row buffering and commands that move the record pointer

Chapter 9: Views in Particular, SQL in General

Visual FoxPro views
What exactly is a view?
How do I create a view?
When should I use a view instead of a table?
Hang on! What is a parameterized view?
How do I control the contents of a view when it is opened?
Why do changes made in a view not get into the underlying table?
Why create a view that is simply a copy of an existing table?
What is the best way to index a view?
More on using views
SQL in Visual FoxPro
Joining tables
Constructing SQL queries
How to Check the results of a query
How to extend a SQL generated cursor
How to check your query's optimization
Which is better for updating tables, SQL or native FoxPro commands?

Chapter 10: Non-Visual Classes

How can I make use of INI files?
Initializing the manager
The default file
File registration
The public interface
Using the INI file manager
How to select a different work area, OOP style!
A word on creating the selector object
How the selector class is constructed
Using the selector class
How can I manage paths in a form's dataenvironment?
The data path manager class
The path management table
The path management class
Using the data path manager
How can I manage forms and toolbars in my application?
The managed form class
The managed toolbar class
The form manager class
Using the form manager
How can I track and handle errors?
Classifying Visual FoxPro's errors
Logging errors
How can I simplify getting messages to my users?
The standard message table
The message handling class
Using the message handler

Chapter 11: Forms and Other Visual Classes

How do I make forms fill the screen regardless of screen resolution?
How do I create resizable forms?
How do I search for particular records?
How do I build SQL on the fly?
How can I simulate the Command Window in my executable?
Wrappers for common Visual FoxPro functions
Presentation classes
Postal code lookup class
Generic log-in form
The lookup text box class

Chapter 12: Developer Productivity Tools

Form/class library editor
Using the SCX/VCX editor
Form Inspector
The table information page
The form information page
The object list page
Construction of the inspection form
Our industrial strength grid builder
Resizing grid columns properly
Renaming columns and their controls appropriately
The Custom Controls page of the grid builder
Adding method code to grid columns
Class cataloger
What VCXList does
A wrapper for 'modify class'
A form/class library documentation utility
Share.prg - a class browser add-in
A kinder finder

Chapter 13: Miscellaneous Things

Using the Visual FoxPro debugger
Features of the debugger windows
Configuring the debugger
Setting breakpoints
Useful breakpoint expressions
Writing code for ease of debugging and maintenance
Working with datasessions
How do I share datasessions between forms?
How do I change datasessions?
How do I get a list of all active datasessions?
Miscellaneous items
What is the event sequence when a form is instantiated or destroyed?
How do I get a reference to a form's parent form?
How do I get a list of all objects on a form?
How can I set focus to the first control in the tab order?
How do I return a value from a modal form?
How do I change the mouse pointer while a process is running?
How can I create a 'global' property for my application?
How can I 'browse' an array?
Windows API Calls
How do I find the file associated with a file type?
How can I open a file using Windows file associations?
How can I get the user's Windows log-in name?
How can I get directory information?
How can I get the number of colors available?
How do I get the values for Windows color settings?
How do I change the cursor?
How do I customize my beeps?
How do I find out if a specific application is running?
Using the DECLARE command

Chapter 14: Project Management

What happens when building an executable?
How to use the project options to your advantage
How do you use a project's Debug Info setting?
How do you use a project's Encrypted setting?
How do you set a custom icon for an executable?
How do you manage files in the Project Manager?
How do you manage Servers from the Project Manager?
How do you set the project's object description?
How to set the executable version information
What are the advantages of including the Config.fpw in the project?
How can we include non-VFP objects in the project?
How to reduce screen real estate taken by the Project Manager
How to tear off tabs from the Project Manager
What problems exist when opening a database in the project?
Project dragging and dropping tricks
What happens when dragging from one project to another?
How do I drag objects from a project to a designer?
What happens when dragging from project to program code?
What happens when dragging from Class Browser or Component
Gallery to a project?
What happens when dragging from a non-VFP application to a project?
How to take advantage of the project User field
How to go about documenting the project file

Chapter 15: Project Objects and Projecthooks

How to use ProjectHooks to catch a big fish
How to set up a global ProjectHook for all projects
What happens when a ProjectHook is lost or deleted?
What did Microsoft leave out of the first release of ProjectHooks?
How to access information in the Project and Files object
How to use Project Objects in development
How to build a basic Application Wizard
ProjectHook and Project Object tricks
How to enhance the base projecthook
How to create a useful development projecthook
How to have the projecthook set the current directory and path
How to programmatically control the VFP IntelliDrop settings
How to remove the printer information from VFP reports
How to track what is done within the Project Manager
How to generate automatic backups of metadata
RAS Project Builder

Chapter 16: Creating Reports

Report Rule #
Formatting techniques
How to speed printing with printer fonts
How to generate the "greenbar" effect
How to generate CheckBoxes in reports
How to reduce/increase white space when printing memo fields
How to display a field in preview but not print mode
How to minimize pain using lines and boxes
How to use float to your advantage
How to print bullet symbols with stretchable fields
How to build a mailing address without gaps
How to use DBC field captions in reports
Band problems
How to avoid orphaned headers and widowed footers
How to have second summary bands with EOF()
How to create flexible control breaks
How to build two (or more) sets of detail lines
How to simulate a detail line longer than one page
How to fix the location of footer
How to print "Continued" when detail overflows
Other report techniques
How to avoid hard coded printer problems
Using Expression Builder for undefined fields in the DataEnvironment
How to get the label formats to be available
Report Metadata Manipulation
How do you change fonts programmatically?
How to convert paper sizes (Letter -> A Print)

Chapter 17: Managing Reports

How to leverage reports and datasessions
How to create a report template for a project
How to print a range of pages
How to print 'Page x of y' on a report
How to allow users to select number of copies
How to find "Variable not found" errors in a report
How to avoid having a report disable the system menu
How to collate pages from different reports
How to display a custom 'Printing Dialog'
How to change the title of Print Preview window
How to show a report preview as a Top-Level form
How to preview multiple reports at once
How to remove printer info. in production reports
How to allow end users to modify report layouts
How to print a memo field with Rich Text Format
How to select the paper tray
Other alternatives to the native Report Designer
How to use OLE Automation to Word
How to output to other file types
How to create HTML and ASCII text output
How to generate PDF output
How to review code from the report/label designer