Logo

Hacker’s Guide to Visual FoxPro
An irreverent look at how Visual FoxPro really works. Tells you the inside scoop on every command, function, property, event and method of Visual FoxPro.

ALANGUAGE()

ALANGUAGE() returns an array containing the elements of the FoxPro language. The elements can be commands, functions, base classes or Database Events. This command was added in VFP 7.

Usage

nItems = ALANGUAGE( ArrayName, nItemType )

Parameter

Value

Meaning

ArrayName

Name

The name of the array to populate with the language elements.

NitemType

1

A one-dimensional array containing a list of commands. Example:

"BROWSE"

2

A two-dimensional array. The first column contains the function list, and the second column contains a code denoting whether the command can be abbreviated ("M" if it must match), how many parameters are required, and how many in total are accepted (preceded by a hyphen). Examples:

"CURSORTOXML", "M2-7"
"DTOC", "1-2"
"FCLOSE", "1"

3

A one-dimensional array containing a list of FoxPro base classes. Example:

"Spinner"

4

A one-dimensional array containing a list of database events. The text in the list does not include the DBC_ prefix. Example:

"AfterCloseTables"

Nitems

Numeric

Number of rows in the array.

ALANGUAGE() returns a list of the elements specified in nItemType. Depending on the value of nItemType, the array may be one- or two-dimensional.

Notice that when commands or functions are returned, the names are in uppercase, while the base classes and Database Events are mixed case (this mimics the usual FoxPro notation, where most keywords, like commands and functions, are capitalized, while OOP properties, methods and events are in “Camel” case, or mixed case).

When passing an nItemType of 2 to obtain a list of functions, you get a two-dimensional array back. The first column contains the name of the function, in uppercase. The second column has one of three codes. If the first character is an “M”, then the command must be typed in as an exact match, meaning you can’t abbreviate the function to four letters. The first number denotes how many parameters are required. If a hypehen and another number are present, this indicates how many parameters are available.

So why should you care? Perhaps you are working on an IntelliSense module, and you want to know if the last word typed was a VFP command. Perhaps you are creating your own syntax-color edit box. Or perhaps, like us, you’re trying to learn everything about the language, and you appreciate the list to make sure you don’t miss anything.

Example

nCommands = ALANGUAGE(aCommands, 1)
DISPLAY MEMO LIKE aCommands
* a list of 168 commands

nFunctions = ALANGUAGE(aFunctions, 2)
DISPLAY MEMO LIKE aFunctions
* a two-dimensional array of the 424 functions,
* with the codes in the second column

nBaseClasses = ALANGUAGE(aBaseClasses, 3)
DISPLAY MEMO LIKE aBaseClasses
* a list of the 36 VFP base classes

nDBEvents = ALANGUAGE(aDBEvents, 4)
DISPLAY MEMO LIKE aDBEvents
* a list of the 58 database events

See Also

AMembers(), Array Manipulation, Database Events