Displays class libraries in the Open dialog box and creates an array containing the name of the class library and class chosen.
AGETCLASS(ArrayName [, cLibraryName [, cClassName [, cTitleText [, cFileNameCaption [, cButtonCaption]]]]])
Specifies the name of the array in which the names of the class library and class are placed. The following table lists the contents of each element of the array created when you chose a class.
File name of the class library chosen.
Name of the class chosen.
- Specifies the name of the class library initially selected when the Open dialog is displayed. cLibraryName can be a visual (.vcx) or program (.prg) -based class library. The class library name you specify is displayed in the File name text box. An error is generated if the class library you specify doesn't exist or cLibraryName is the empty string or the null value.
- Specifies the name of the class initially selected in the Class name list when the Open dialog is displayed. If the class you specify doesn't exist, the first class in the Class name list is selected. An error is generated if you omit cLibraryName or cClassName is the null value.
- Specifies the text displayed in the title bar of the Open dialog. By default, "Open" is the text displayed.
- Specifies the text displayed next to the File name text box. By default, "File name:" is the text displayed.
- Specifies the caption for the OK button.
Logical data type. AGETCLASS(В ) returns True (.T.), if you chose a class, and creates a one-dimensional array containing two elements. The first element contains the file name of the class library chosen; the second element contains the name of the class chosen. AGETCLASS returns False (.F.) if you exit the Class Library dialog box by pressing ESC, choosing Cancel, or clicking the Close button.
If the array you specify does not exist, Visual FoxPro automatically creates the array.
If the array exists and is not large enough to contain the names of the class library and class, Visual FoxPro automatically increases the size of the array.
If the array is larger than necessary, Visual FoxPro truncates the array. If the array exists, and AGETCLASS(В ) returns False (.F.) because the Class Library dialog box was closed by pressing ESC, choosing Cancel, or clicking the Close button, the array remains unchanged.
If the array does not exist, and AGETCLASS(В ) returns false (.F.), the array is not created.
Visual FoxPro 8.0 does not support AGETCLASS(В ) in its run-time libraries. AGETCLASS(В ) is supported in Visual FoxPro 9.0 run-time libraries, but the Program (*.prg) option is not available in the Files of type drop-down list box.
The following example creates an array named
aClassLib. The directory is changed to the \Samples subdirectory that contains the sample class libraries. AGETCLASS(В ) is used to display a dialog with the Buttons class library and the VCR class selected. If you choose the Modify button, the name of the class library and class you select is stored in the array. The class is then opened in the Class designer.
LOCAL aClassLib(2) && Create an array, initialized to .F. cCurrentDir = CURDIR( ) && Save the current directory. CD HOME(2) + 'CLASSES' && Switch directories. AGETCLASS(aClassLib, 'BUTTONS.VCX', 'VCR', 'Modify Class', ; 'Class File:', 'Modify') && Display the dialog. CD (cCurrentDir) && Switch to the previous directory. IF TYPE('aClassLib(2)') = 'C' && Class chosen? MODIFY CLASS (aClassLib(2)) OF (aClassLib(1)) && Open to modify. ENDIF