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.
AGetClass()
, AVCXClasses()
These two functions are aimed more at tool builders than application builders. AGetClass()
displays the Class Open dialog and returns information about the class chosen. AVCXClasses()
fills an array with information about all the classes in a class library.
lChoseOne = AGetClass( ClassInfo [, cClassLib [, cClass
[, cDialogCaption [, cFileNameCaption
[, cButtonCaption ] ] ] ] ])
nClassCount = AVCXClasses( ClassInfo , cClassLib )
Parameter |
Value |
Meaning |
ClassInfo |
Array Name |
An array containing the requested information. For AGetClass(), the array has two elements in a single row—the class library and class name chosen. For AVCXClasses(), the array has one row for each class in the library, with 11 columns containing information about the class. |
cClassLib |
Character |
For AGetClass(), the name of the class library to highlight initially. For AVCXClasses(), the name of the class library whose class information goes into the array. |
cClass |
Character |
The class to highlight initially. |
cDialogCaption |
Character |
The caption to put on the Open dialog. |
Omitted or "" |
The dialog caption is "Open". |
|
cFileNameCaption |
Character |
The string to display next to the File Name prompt. |
Omitted or "" |
"File Name:" is displayed. |
|
cButtonCaption |
Character |
The caption for the OK button. |
Omitted or "" |
The button says "OK". |
|
lChoseOne |
.T. |
The user chose a class. |
.F. |
The user chose Cancel or ESC. |
|
nClassCount |
Numeric |
The number of classes in the class library chosen. |
AGetClass()
lets you prompt a user (who’s probably a developer) to choose a class and provides the class library and class as a result. The various parameters let you customize the dialog to a great extent. Note that you can’t skip over the earlier parameters to just provide the later ones (for instance, =AGetClass(aCl,,,”Chose a Class”) gives the error “Function argument value, type or count is invalid”). But you can pass the empty string for any parameter except the class library and VFP behaves as if you’d stopped before you got there. So, = AGetClass(aCl,”controls.vcx”,””,”Choose a Class”) works just fine. However, if you pass “” for cClassLib, VFP yells.
AVCXClasses()
lets you find out what’s out there, a really handy trick when you’re building developer tools. Not only does it give you the list of classes in the class library, but it tells you a great deal about them, including the base class and parent class, the name of the #INCLUDE file, and more.
One warning: The classes aren’t put in the array in any particular order. To be more accurate, they’re in the order of their records in the class library, which isn’t likely to be a useful order.
* Start in the FFC subdirectory
lGotOne = AGetClass(aClassInfo,"_base.vcx")
* To find out what classes are in the library
* containing the class just selected
nClassCount = AVCXClasses(aClassList, aClassInfo[1,1])