Skip to content

gmplCoclassStatement

Coclass is a terminal or nonterminal declaration statement that occurs only in reference scripts. It declares a class that is actually the union of a group of classes.

The terminal form of the Coclass statement is used to deal with the forward reference problems in library declarations. It is often the case that a component in one class has the type of another type defining component that has not yet been defined. Rather than trying to sort the definitions into a “reference” order, gmBasic when it authors the declarations places a set of terminal Coclass statements in the front of the library declaration with only the Id attribute specified. The later Coclass statements with the same Id then specify the remaining attributes and substatements.

The attributes of the Coclass statement are as follows:

AttributeDescription
IdThis attribute is the identifier of the coclass. It must be unique with the scope of the library
containing the coclass. The identifier is not case-sensitive. This attribute must be specified
on all declarations, be they terminal or nonterminal.
RoleThis attribute contains an optional keyword describing the overall role of the coclass: Unknown,
Property, Method, Define, Utility, Command, Constant,
Function, Event, Control, Collection, Resource, Index, or
Migclass. The default is None. Coclasses often have a Control role.
MigNameThis attribute supplies the name to be used for the coclass in the target translations.
MigStatusThis attribute is a MigStatus attribute as discussed on the Declaration page. It
contains generalized migration settings for the component
CreatableThis is an On/Off flag attribute. The Off setting sets the Noncreatable status
flag On. It means that the coclass objects cannot be created. When declaring objects
of this coclass simply NULL them as opposed to using new to create an instance.
CastTypeThis is an On/Off flag attribute. The Off setting sets the Casttype status
flag On. This means that the coclass does not require type casts when setting its values.
AppObjectThis identifier attribute sets the AppObject status flag on and stores the identifier in the
description table of the coclass. It means that the coclass has an application wide singleton object
which requires that special AppObject code be authored for it.
MigCommentThis deprecated string attribute associates a comment with the coclass. This comment does not
trigger the gmNI event handlers.
StaticThis is an On/Off flag attribute. The On setting sets the External status
flag On. This means that the coclass is external to the library in the target implementation to
which it was assigned in the source implementation. Therefore, when authoring the identifier
of the coclass do not precede it with its source parent membership information.
MigPatternThis string attribute associates a surface pattern string with code references to the coclass. See
the Patterns page for details on the content of pattern strings. It is equivalent to the All
pattern.
CshPatternThis string attribute associates a surface pattern string with code references to the coclass. See
the Patterns page for details on the content of pattern strings. It is equivalent to the Csh
pattern.
VbnPatternThis string attribute associates a surface pattern string with code references to the coclass. See
the Patterns page for details on the content of pattern strings. It is equivalent to the Vbn
pattern.

The declarations within the Coclass statement are as follows:

SubstatementDescription
SubclassIdentifies a class that is a member of the coclass.

The script errors associated with the Coclass statement are as follows:

ErrorDescription
1058Coclass command missing required id attribute.
1059Unable to store coclass vector: %1d
1060The role keyword [%1d] is not recognized.
1061Encountered following when expecting ‘subclass’: %1d


Subclass is a terminal substatement of the Coclass statement. It identifies a class that is a member of the coclass.

The attributes of the Subclass substatement are as follows:

AttributeDescription
IdThis attribute is the identifier of a class within the same library that is a member of the coclass.
Classes may be members of multiple coclasses.

The script errors associated with the Coclass statement are as follows:

ErrorDescription
1062Subclass command missing required id attribute.
1063Unable to find subclass: %1d