SET CLASSLIB Command
Opens a .vcx visual class library containing class definitions.
- TO ClassLibraryName
Specifies the name of the .vcx visual class library to open. If ClassLibraryName does not include a fully qualified path, Visual FoxPro first searches for the visual class library in the default Visual FoxPro directory, and then in the directories in the Visual FoxPro path. The default Visual FoxPro directory is specified with SET DEFAULT, and the Visual FoxPro search path is specified with SET PATH.
Issuing SET CLASSLIB TO without ClassLibraryName closes all open visual class libraries. Use RELEASE CLASSLIB to close an individual visual class library.
- IN APPFileName| EXEFileName
Specifies a Visual FoxPro application file (.app) or executable file (.exe) containing the visual class library.
Opens the .vcx visual class library without closing any currently open .vcx visual class libraries. If this clause is omitted, all open .vcx visual class libraries are closed.
- ALIAS AliasName
Specifies an alias for the visual class library. The visual class library can be referenced by its alias. For example, the following commands open a .vcx visual class library named MyClass, assign it the alias MyCntrls, and then create a control named MyButton.
SET CLASSLIB TO MyClass ALIAS MyCntrls mMyButton = CREATEOBJ('MyCntrls.MyButton')
When CREATEOBJECT( ), ADD OBJECT in DEFINE CLASS, or the AddObject method is issued, Visual FoxPro searches for the class definition defining the object specified in these commands in the following locations and order:
The Visual FoxPro base classes.
Class definitions in memory in the order they are loaded.
Class definitions in the current program.
Class definitions in the .vcx class libraries opened with SET CLASSLIB.
Class definitions in procedure files opened with SET PROCEDURE.
Class definitions in the Visual FoxPro program execution chain.
The OLE Registry if SET OLEOBJECT is set to ON.
If the class definition containing the object cannot be located, Visual FoxPro generates an error message.
The following example uses CREATE CLASSLIB to create a visual class library named myclslib. A class named myform based on the Visual FoxPro Form base class is created and is stored in the myclslib visual class library. SET CLASSLIB is used to open the myclslib visual class library so that classes within it can be used.
CREATE CLASSLIB myclslib && Creates a new .VCX visual class library CREATE CLASS myform OF myclslib AS "Form" && Creates new class SET CLASSLIB TO myclslib ADDITIVE && Opens MyClsLib.VCX