Back

Stretching Intellisense to the Limit

Jim Booth

Who is this session for?

This session has a how to focus on certain of the new features in Visual FoxPro 7.0. The attendee does not need to have any extensive knowledge of Visual FoxPro to understand this session.

Intellisense

The Visual FoxPro help system defines intellisense as, “IntelliSense in Visual FoxPro displays popup windows and dropdown lists that assist you with statement and function completion syntax, and displays the available variables, objects, properties, methods, and events (PME) of objects.”

Intellisense is new to VFP 7.0 and is a very promising addition to the feature set. In the session we will demonstrate the various capabilities of Visual FoxPro’s intellisense.

Unique to Visual FoxPro

There are a few things about intellisense in VFP that are unique from other products. One of them is related to working with COM servers and objects. To understand this feature we must first introduce you to another new ability, casting type on the declaration of variables.

VFP 7.0 will accept the following line of code without error.

LOCAL oExcel AS Excel.Application

This new feature does not provide strong typing to VFP. It is helpful in self-documentation and it allows VFP to check the type library for COM classes during editing of the code. By doing this VFP can provide Intellisense during coding that is related to the COM class with which you are working.

Not only does VFP provide the intellisense assistance, but also VFP can go one better than other products in this area. In the session we will demonstrate for you exactly how VFP’s intellisense is better than other products.

VFP’s intellisense is extensible because, the same as so many other things in VFP, intellisense is extensible by the developer. You can add your own features to it.

The FoxCode table

The intellisense actions for Visual FoxPro are defined and controlled by a table named FoxCode.dbf. The following description of the fields in the FoxCode table is taken from the help file.

Field name Type (size) Description
Type C (1) Specifies the type of reference contained in this record.
The following table lists the available types.
Abbrev C (24) Represents the minimum set of keystrokes that trigger IntelliSense for this item.
Expanded C (26) Specifies what is inserted at cursor.
Cmd C (15) Specifies the Command to execute for this item.
Tip M

Specifies the contents of the Quick Tip info (parameters).
Data M Specifies all List values or any Visual FoxPro code specific to this item. Can, optionally, contain other script text.
Case C (1) Specifies how the text is replaced.

U Upper
l Lower
M
or
<empty>
Mixed
P Proper
X Unchanged

Any value you specify in this field of the version record sets a global default that is overridden by individual record settings.

Save L Specifies whether the record is saved when the field updated
TimeStamp T Represents the Unique timestamp for this item
Source M Specifies the source of record content. Core contents shipped with Visual FoxPro 7 are specified as RESERVED here. This field can contain path and file name of user-supplied records.
UniqueID C (10) Specifies a unique identifier for this record.
User M  

The type field defines what type of intellisense action a given record will elicit. The available types are: Command (C), Function (F), COM Typing (O), Property (P), Script (S), Typing (T), User (U), and Version (V). Reviewing the FoxCode table will show what these various types are. The one of special interest is the User type. This si the type we can use to create our own intellisense actions.

What else is new?

There are some related new features in the editing area of VFP 7.0. Three of these are Bookmarks, Short Cuts, and the Task List.

Bookmarks are non-persistent placeholders in your editors. You can set a bookmark by right clicking at the location you want to mark and choosing Toggle Bookmark from the shortcut menu. A bookmark placed this way will remain with the entry until you toggle the bookmark off or you quit Visual FoxPro. If you simply close the editor and open it again the bookmark will persist.

You can move between your bookmarks using the Edit-Bookmarks-Next Bookmark or Previous Bookmark commands in the menu system.

The Task List

The task list is a new utility in Visual FoxPro 7.0 that allows you to maintain a list of tasks that need to be completed and to manage those tasks. The task list not only keeps the list for you but it also provides a mechanism to move between those tasks. Below is a screen shot of the task list interface.



The columns in the task list tell you about the specific task. The first column is the priority and it can be set to Low, Normal, or High the two tasks shown here are both at low priority. The Contents column shows an excerpt from the source code for the task. The File Name column shows us the name of the file associated with the task. Finally the due date column allows us to set a due date for any task. Double clicking on any task will open that file and set you to the area of the file where you established the task shortcut.

Task List Short cuts

You can set a task list short cut while you are working in an editor. The shot below shows how.



Highlighting an area of code and then right clicking will produce the menu shown above.  Choosing “Add Task List Shortcut” form this menu will establish the short cut and the editor will appear as below.



The arrow in the left column of the editor indicates the shortcut.  Looking at the task list again we see our new task added to the list.

<


Summary

As you can see Microsoft has added many new features to Visual FoxPro 7.0 that are specifically intended to make our lives easier as developers. Some of these will certainly make using VFP a much more convenient and efficient method of developing applications.