Freigeben über


SET CLASSLIB Command

Opens a .vcx visual class library containing class definitions.

SET CLASSLIB TO ClassLibraryName [IN APPFileName | EXEFileName]
   [ADDITIVE] [ALIAS AliasName]

Parameters

  • 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.

  • ADDITIVE
    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')
    

Remarks

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:

  1. The Visual FoxPro base classes.
  2. Class definitions in memory in the order they are loaded.
  3. Class definitions in the current program.
  4. Class definitions in the .vcx class libraries opened with SET CLASSLIB.
  5. Class definitions in procedure files opened with SET PROCEDURE.
  6. Class definitions in the Visual FoxPro program execution chain.
  7. 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.

Example

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

See Also

ADD CLASS | AddObject Method | CREATE CLASS | CREATE CLASSLIB | CREATEOBJECT( ) | MODIFY CLASS | RELEASE CLASSLIB | SET PROCEDURE | SET OLEOBJECT