Versión en español de este artículo
18 VFP Productivity Boosters
A bunch of time-saving tips that all VFP developers can use.
In the brochure for our Visual
FoxPro training courses, we claim that our training "will
make you a faster and more productive developer".
Fortunately, that's an easy boast to live up to, given that VFP
is crammed full of useful shortcuts designed to save the
programmer valuable time.
To be honest, none of these
techniques will save you a huge amount of time on its own. But,
used together over the course of a development project, they
could make a noticeable difference to your productivity as
well as making VFP a pleasanter place to work in.
So let's get started ...
- For a fast way of opening a table in the VFP development environment, just click on
its name in the Project Manager.
- Holding down Ctrl, Alt and
Shift simultaneously will temporarily hide all open
windows, which is great if you need to see some output on
the background screen. Release the keys to bring the
- If the Command Window is
lost deep in your desktop, hit Ctrl-F2 to bring it
quickly to the front.
- Talking of the Command
Window, you know that you can scroll back and re-execute
earlier commands. But did you know that you can also
execute entire blocks of commands? To do so, highlight
the block, right-click and select Execute Selection. This technique also
works in code-editing windows.
- When working on the design
surface within the Form Designer, hit Tab to quickly
bring the Properties window to the front.
- Press Ctrl-PgUp and
Ctrl-PgDn in the Properties window to cycle through the
- To quickly locate a given
property, press Ctrl, Alt and the first letter of the
name. Pressing Ctrl-Alt-F, for instance, will take you
to the first property whose name begins with F.
- In the code window in the
Form Designer, PgUp and PgDn will cycle through all the
methods which actually contain code.
- And double-clicking on an
object on the design surface will take you to the first
method in alphabetical order which contains code for the
- If you go to Tools |
Options | Forms and de-select "Prompt to save
changes before running form", the form will be
automatically saved each time you run it from the
- When dropping a class on
the form, if you cannot find the appropriate button on
the toolbar, drag the class from the Project Manager
- If you cannot figure out
what's gone wrong with the form, it usually pays to focus
on the properties and methods that have changed from
their defaults. These are
highlighted in bold within the property window. Going further,
you can right-click in the Properties
window and select "Non-Default Properties
Only". This will hide everything that is unchanged,
making it easier to see what you have altered.
- How many times have you
needed to type a field name in your code, only to find
that you could not remember the exact name or the
spelling? Just right-click, select Build
Expression, and pick the field from the Expression Builder (this assumes that the table is open in the
- Or ... simply drag the
field from the Project Manager (or Database Designer)
and drop it in the editor.
- Similarly, you can insert
a fully qualified object name (such as
THISFORM.MyGrid.Column1.NameField) by right-clicking in
the editor, selecting Object List, and picking the
appropriate name from the resulting dialog.
- Need to comment-out a
large block of code? Select the code in
question, right-click, and pick Comment. Reverse the
action by picking Uncomment. The nice thing about this is
that the Uncomment command acts only on code that was
disabled by the Comment command, not any existing
comments within the block.
- Developers moving from
FoxPro 2.x to VFP 3.0 were often dismayed to find that the
Beautify feature had been retired. In 5.0, it made a
come-back. Look for it on the right-click menu in the
code editor, and also on the Tools menu in VFP 7.0 and later.
- If you don't want to be
nagged to run a wizard every time you start a new form,
report or whatever, visit Tools | Options | Projects and
de-select "Prompt for Wizards". This affects
the New button in the Project Manager, but not the File |
New command or the New button on the main toolbar.
Useful as all these tips are, the
real productivity booster in Visual FoxPro is its outstanding use of object-orientation,
and especially the ability it gives developers to create re-usable code and components.
This is the topic that we emphasize in our training courses.
Mike Lewis Consultants Ltd. January 1998. Revised November 2001 and January 2006.
FoxStuff is maintained by Mike Lewis Consultants Ltd. as a service to the
VFP community. Feel free to download and use any code or components, and to pass around copies of the
articles (but please do not remove our copyright notices or disclaimers).
The information given on this site has been carefully checked and is believed to be correct,
but no legal liability can be accepted for its use. Do not use code, components or techniques
unless you are satisfied that they will work correctly in your applications.
© Copyright Mike Lewis Consultants Ltd.