将一个类的实例存放到一个内存变量数组中,并且返回数组中存放的实例个数。
语法
AINSTANCE(ArrayName, cClassName)
参数
ArrayName
指定存放实例的数组名。如果指定数组不存在,
Visual FoxPro 将自动创建指定的数组。如果数组存在,但其大小不足以包含所有实例,
Visual FoxPro 则自动增加数组大小,使数组能容纳所有实例。如果数组大小大于所需值,
Visual FoxPro 将截掉多余部分。如果数组存在,但由于没找到实例使 AINSTANCE( ) 函数的返回值为 0,则不改变数组。如果数组不存在,并且 AINSTANCE( ) 函数的返回值为 0,将不创建指定数组。
只有用 CREATEOBJECT( ) 赋给内存变量和数组元素的类实例才存放到数组中。
cClassName
指定 Visual FoxPro 基类名或用户自定义类名。下表列出了可以给 cClassName 指定的 Visual FoxPro 基类。
| 基类名称 | |
| ActiveDoc | Label |
| CheckBox | Line |
| Column | ListBox |
| ComboBox | OLEControl |
| CommandButton | OLEBoundControl |
| CommandGroup | OptionButton |
| Container | OptionGroup |
| Control | Page |
| Cursor | PageFrame |
| Custom | ProjectHook |
| DataEnvironment | Relation |
| EditBox | Separator |
| Form | Shape |
| FormSet | Spinner |
| Grid | TextBox |
| Header | Timer |
| Hyperlink | ToolBar |
| Image |