Wiki Home

Visual FoxPro 7 Features

Namespace: WIN_COM_API
This is a collection, from various sources, of information about new features in VFP7. I'm hoping that some of the more interesting ones might be worthy of further description. -- Nancy Folsom
This first bit is from an article by Nick Neklioudov and David Stevenson .

NOTE: This article was written by your humble reporters based on information bouncing around in their feeble brains and from hastily scribbled (and often unintelligible) notes. Maybe we got most of it right. :-) -- David Stevenson

How about a cheer for this exciting new keyword added to SELECT:

SELECT * FROM Mytable INTO CURSOR Mycursor READWRITE to create an updatable cursor!!!!!!
Actually, this is not entirely correct. It creates a read-write cursor but no updated values will be written back to the data source. -- MarkusEgger

You can override an existing connection string defined for a remote view with a new "CONNSTRING" clause on the USE MyRemoteView CONNSTRING "Driver=... blah, blah"

A new array function ATAGINFO(MyArrayName, "MyTable.cdx") will give you an array with all index tag information for a table.

BROWSE NOCAPTION will show actual field names instead of captions defined in the DBC.

SYS(3054) now shows filter optimization, join optimization and rushmore optimization.

ASCAN(...) now supports a parameter to indicate the array column to be scanned, and also has added "flags" for turning on or off Case Sensitivity and SET EXACT.

ASORT(...) also has the added flag for Case Sensitivity.

Stolen from the parameterized view prompt, we now get a function called INPUTBOX(...) to get user input and return text, with a timeout.

GETDIR() now can have an option for adding a new folder, also can have a right-click context menu, and is resizable.

DISKSPACE() has been fixed and works on large drives and NTFS, and reports more information.

OS() can now report version major and minor numbers, service pack information, whether running on Win 2000 Professional, Server, Advanced Server, Terminal Server, etc.

Many new ways of creating programs, HTML or XML output strings, or foxscript are made possible by several new clauses added to
.... HTML here ....

This will enhance our abilities to dynamically create web pages or XML into string variables to be passed back to a calling process. We will not need to +CHR(13)+CHR(10) to get CRLF's.

Similar to this enhancement is SET TEXTMERGE TO MEMVAR cMyString NOSHOW.

Related to both of these, a new function EXECSCRIPT(cMyString) will run the code inside the character string. It is the same functionality as selecting lines in the Command Window, right-click and Execute -- but available for use programmatically.

APROCINFO(aMyArray, "genmenu.prg") will create an array with 4 columns, two of which are Procedure Name and Line Number.

EDITSOURCE(nShortcutID | cFileName [,nLine] [,cClassName] [,cProcName]) will bring up the editor with the program opened to a particular line, by line number, class name, or procedure name.

Anyone who has struggled with a grid's AfterRowColChange event will be overjoyed to find a new grid property called RowColChange which will contain a numeric value indicating just what really changed:
0 - nothing
1 - row
2 - column
3 - both row and column
All forms, including "_screen", now have a new hWnd property.

ADLLS(aMyArray) will build an array with information on all dll's currently declared.

ALANGUAGE(aMyArray, nOption) will load the array with lists of information, according to the nOption specified:
1 - commands
2 - functions, with number of parameters
3 - base classes
4 - DBC events
Speaking of DBC events, we were able to catch a rushmore-optimized glimpse (Calvin was typing) of a few more of the database events that will fire when various actions are taken. It's a very long list. In addition to those already mentioned in the other reports, we saw:
BeforeModifyProc (and AfterModifyProc)
BeforeDropRelation (and After..., etc)
There is a new Splash Screen feature with timeout.

DBC Events are also supported in the new OLE-DB provider, which also will work much more closely with ADO, and will support table creation and the "iopenrowset" interface.

The new strong-typing syntax is not enforced at run-time, but is added to enhance type library compatibility, enable Intellisense, and provide necessary features for participation in COM+. We will have statements like the following:
LOCAL oExcel AS excel.application

PROCEDURE MyProc(cParam1 AS String, nParam2 AS Number @) AS Boolean

The return value of the procedure could be Boolean, String, or any of several other types, but we also can specify it AS VOID to indicate that a NULL return value is OK. The VOID type is necessary for the component to be a COM+ Queued Component.
Several of the Fox team have commented that they have been paying attention to the many requests that have come in from the community, resulting in many of the new features. It is likely, however, that priority first goes to new language enhancements and architecture changes necessary to participate as fully as possible in COM+ or to implement new directives from Microsoft such as "You will support IACCESSIBLE". As various changes are made, the need arises for new functions and commands or enhancements to the old, so Calvin just takes a minute or two and adds them. :-)

A lot has been said here about the changes being made to support Active Accessibility, which are quite extensive. Every UI element -- form, textbox, button, grid, cell in grid, etc., has a COM-addressable identity through the "IACCESSIBLE" interface, and can be queried by outside programs for that information.

Outside programs can receive events triggered by user actions, and can keep up with where the focus is on a form. Outside programs can talk to the current window that has focus, and to that window's UI elements and set properties or tell them what to do, such as telling a command button something like "DoDefaultAction", which would be a click.

All of the IACCESSIBLE stuff is there to support a major Microsoft initiative related to people with disabilities, but there are many other interesting and innovative uses for it, such as automated testing. And in usual fashion the Fox team and Fox developers will find some very interesting other uses for it, too. :-)

It's hard to tell from the very fast demos which of the new items are for Accessibility and which are for COM+. For example, we saw a new array property that is added to each property, similar to the way ACCESS and ASSIGN are named. This was seen inside a CLASS definition:
DIMENSION MyProp_comattrib(4)
   (MyProp is now readonly)
MyProp_comattrib(2)="MyProp Help String Text"
   (that text shows tooltip-style in the new Object Browser)
   (this allows capitalization of property name to be preserved)
   (property type)

We saw the result of these settings in the Object Browser, but were they added for IACCESSIBLE or COM+? It seems that Microsoft's directives for their products to support new standards has given the Fox team plenty of ammunition for other features.
A small but sometimes handy thing I've found in 7 is if you hold down the Control key and use the Up and Down arrows in a code window, it now scrolls the contents of the window line by line leaving your cursor where you are. Handy if you are in the middle of the window and want to stay there to continue editing but need to see the line(s) just above/below what is showing in the window. (Yeah that's what scroll bars are for but I'm a keyboard freak) Andy Needham
AUSED( ) Function -- Places table aliases and work areas for a data session into a variable array. AUSED(ArrayName [, nDataSessionNumber])
ASESSIONS( ) Function -- Creates an array of existing data session IDs. ASESSIONS(ArrayName)
EDITSOURCE( ) Function -- Opens the Visual FoxPro editor and, optionally positions the cursor. Required by Editor Tasklist Shortcuts. EditSource(cShortCutID | [ cFilename [, nLineNo] [, cClassName]
[, cMethodName|cProcName]])
GETWORDCOUNT( ) Function -- Counts the words in a string. GetWordCount(cString[, cDelimiter])
GETWORDNUM( ) Function -- Returns a specified word from a string. GETWORDNUM(cString, nIndex[, cDelimiter])
Cursor To XML( ) Function -- Converts Visual FoxPro cursor to XML text. Cursor To XML(nWorkArea | cTableAlias, cOutput [, nOutputFormat
[, nFlags [, nRecords [, cSchemaName [, cSchemaLocation [, cNameSpace ]]]]]])
XML To Cursor( ) Function
XML Update Gram( ) Function
ASTACKINFO( ) Function -- Returns an array that provides information about an object in the currently running program, application, or COM Server. AStack Info(ArrayName)
The following table describes the information returned by the ASTACKINFO( ) function: Array Element Description
1 Call Stack Level
2 Current program filename
3 Module or Object name
4 Module or Object Source filename
5 Line number in the object source file
6 Source line contents
My all-time favourite new feature in VFP 7.0 is the Document View window. It makes navigating methods and procedures so easy. If you haven't explored it yet, give it a try. Years ago, I wrote something similar using Brief macros (anyone remember Brief?), It's great to see this feature in VFP 7.0 now. -- Mike Lewis
Category VFP Functions Category VFP Commands
( Topic last updated: 2002.07.15 04:10:22 PM )