one question that seems to come up fairly often is how to control some of the more irritating facets of the visual foxpro intellisense engine. intellisense was first introduced to the developer world in microsoft visual basic 5.0 and has been widely implemented as an essential developer productivity enhancement in many languages. the implementation in visual foxpro, which was introduced in version 7.0, is unique among them in that it features an open architecture that allows developers to both customize and extend the built-in features. whilst a discussion of the full capabilities of intellisense is beyond a simple blog article, i hope the following information on configuring intellisense will prove useful.

_vfp.editoroptions

the basic functionality of intellisense is controlled through the editoroptions property of the vfp application object (which can be accessed directly or by using the _vfp system variable). the default setting for this property is “lqkt” although there actually are five basic features that are implemented in all versions of intellisense, and a sixth that was added in visual foxpro version 9.0. these are:

·         hyperlinks (“k or k”). determines how links are activated. setting to “k” requires only a single mouse click, while “k” requires that ctrl+click is used - which is the default. if neither is specified, hyperlinks are treated as normal text in editing or command windows.

·         word drag ‘n’ drop (“w”). when enabled, text can only be dragged to a position immediately following a space. prevents text being (inadvertently) inserted into existing text when using drag and drop in an editor or the command window. this behavior is disabled by default.

·         designer value tips (“t”). this controls whether the items displayed in lists show their associated ‘tool tips’. by default, they are shown as you scroll through member lists.

·         list members (“l or l”). this controls whether, and when, the object member lists are displayed. by default, lists are automatic (“l”). when set to the lower case “l” option the list only appears when ctrl+j is pressed (or select ‘list members’ from the “edit” pad on the main foxpro menu).

·         quick info (“q or q”). this controls whether, and when, the various types of quick info is displayed. by default, the display is automatic (“q”). when set to the lower case “q” the quick info only appears when you press ctrl+i (or select ‘quick info’ from the “edit” pad on the main foxpro menu).

·         rich text copy( “x”). this setting was introduced in vfp version 9.0 and suppresses the functionality that copies text to the clipboard using rich text formatting. by default it is omitted, so that all text is copied in rich text format. this means that when you paste it into another application (an e-mail message, or document for example) it retains the syntax coloring and settings that you have set up in the vfp editor. by including the “x” in the editoroptions string, ensure that text is copied as plain text – this is useful when producing documentation, or other materials, that must print properly in black and white.

the important ones to note here are the lower case options for the list members and quick info settings. if you substitute the lower case values for the defaults, you do not disable intellisense but it will not display automatically.

so if you are constantly irritated by the appearance of the large yellow boxes that hide your work when writing simple sql select or browse commands, try setting the “q” value to “q” instead. this stops the quick info tips popping up automatically but if you need to see one, pressing ctrl+i, anywhere in the command, will immediately display the tooltip. (note that doing this will also disable the lists of commands/options available when you, for example, you type set or use).

similarly if you find the constant popping up of lists of object properties, events and methods annoying, just set the “l” to “l”. now you can continue to type your object references yourself but, if you need a list have it available by pressing ctrl+j.

custompems record in foxcode.dbf

in addition to the editoroptions property there is a special record in the foxcode table that stores the settings for a number of additional configuration properties. these can be accessed through the advanced tab of the intellisense manager or by opening foxcode.dbf directly and issuing the command:

locate for type = "z" and abbrev = "custompems"

the number of properties depends upon the version of visual foxpro that you are using. in vfp 7.0 there were 6 (one of which never made it into the documentation), while an extra two were added in vfp 8. the following table lists these properties and describes what they do:

property

purpose

lenablefullsetdisplay

default = .t.

many set commands take, as part of the basic syntax, a ‘to’ modifier. this property determines whether that ‘to’ is included as part of the intellisense auto-expanded command. the default value is true, but we prefer to turn this one off. the reason is that even if you type the full command yourself, intellisense still adds the ‘to’ with the result that you tend to get errors because you end up with a command line like this:

set index to to names

lhidescripterrors

default = .f.

according to the help file this property “suppresses screen output of intellisense script errors”. the default is false. in fact, this is another setting that only applies to scripts that use a local instance of the foxcodescript class. that class defines a custom error display and it is whether that display is enabled or not that this property controls.

if there is an error in any other type of script you will get either the appropriate standard error message (when applicable) or a simple dialog with the text “foxcode script failure” irrespective of the setting of this property.

lkeywordcapitalization

default = .t.

controls the auto-expansion and capitalization of the subordinate parts of commands. the default setting is true. used in the replacekeyword() method of foxcode.prg. note: this only affects capitalization when you actually type the full command (e.g. clear all). auto-inserted commands are capitalized according to their individual rules.

lpropertyvalueeditors

default = .t.

according to the help file this property “enables scripts that trigger value editors for certain properties”. the default is true. in fact, this property determines whether scripts defined in foxcode.dbf for records with type = “p” are executed. it does not affect any of the standard value lists that are defined for properties that continue to be displayed irrespective of this setting.

lexpandcoperators

default = .t.

enables “c-style” auto-expansion of plus and minus operators:

lcvar ++” and “lcvar - -” expand as “lcvar = lcvar + 1” and “lcvar = lcvar –1

but, unlike c, vfp intellisense also allows us to use the “=” with any arithmetic operator to auto-expand the string. thus,

lcvar +=” becomes “lcvar = lcvar + ” and “lcvar *=” becomes “lcvar = lcvar *

lallowcustomdefscripts

default = .t.

this was the undocumented property in vfp 7.0. the foxcodescript.defaultscript() method (which is the method called whenever intellisense encounters a space) uses the setting of this property to determine whether a hook method named handlecustomscripts() is called or not. if you do not intend to use custom scripts to modify default behavior, you should set this one to false because the default script is called every time you type a space in an editing window

lenablemultiwordcmdexpansion

default = .t.

vfp 8.0 and later

controls whether multiple part commands are automatically expanded. the default is .t. and when set to .f. commands like index on must be typed in full. note that setting this to .f. also disables capitalization of the secondary key words, irrespective of the setting of lkeywordcapitalization

ldebugscripts

default = .f.

vfp 8.0 and later

controls whether scripts that use a custom version of the foxcode object can be traced line by line in the debugger. the default is .f. note that this only affects scripts that use their own local instance of the foxcodescript class.

Leave a Reply

Your email address will not be published. Required fields are marked *