IntelliSense in Visual FoxPro
IntelliSense was advertised as something that would bring VFP up to the
level of Visual Basic but in typical FoxPro fashion the team went one
IntelliSense provides a variety of services but I particularly like the
way that we can add our own entries to the FoxCode table. As an example,
if I type
in a program now I get:
where the date is inserted automatically and the cursor is positioned
one space to the right of the '*--' on the first line, ready for me to
type my comments into the program. It's a big help when I'm editing
other people's code. I've always known that I ought to be commenting
my changes and I do it a lot more now that it's so easy.
How to use VFP Intellisense
You can hack the FoxCode table directly but it's easier to start by
using the IntelliSense Manager. This is available on the
DO FoxCode in the Command Window.
menu or by typing
Select the Custom tab and type a new abbreviation - in this example
I've used Changed By'.
Click the Script button and what looks like a procedure-editing
window will open.
Write this code in the window:
oFoxCode.Location = 1
oFoxcode.valuetype = 'V'
lcComment = oFoxCode.Abbrev
Save your changes by closing the edit window and the IntelliSense
Open a program edit window and test the new entry by typing
should see the 'CB' disappear and be replaced by the comments.
If it does not work, open the IntelliSense Manager and make sure that
is ticked on the
Debugging a script is difficult. You can insert
Set Step On
into the code to open the debug window and suspend execution but you
cannot Resume again. The best way of debugging
is to go back to the old technique of adding
DebugOut statements at crucial points.
Note that this piece of code used FoxPro's
text merge commands.
I've also modified the IntelliSense table entries to help me write HTML. I'm
writing this page now in
and I've just inserted a pair of paragraph tags:
by typing the two-character code
This inserts the tags then moves up a line and two spaces across so that
my text will be nicely formatted.
There's some help in VFP Help under 'IntelliSense' and 'Scripting' and
you can look at the sample entries on the IntelliSense Manager. There are more good
examples on the
under the CategoryIntelliSense heading.