Navigation: How To's and Troubleshooting > How to… >====== How to Create ABC Compliant Classes ====== | |
The classes you use with the ABC Templates must be ABC Compliant Classes. That is, the classes must conform to the ABC Library specification as documented in the ABC Library Reference
The ABC Templates generate code that refers to the properties, methods, and method parameters documented in the ABC Library Reference. If those properties, methods, and parameters are not defined within the classes you specify, the template generated code will not compile. Further, if the classes do not perform as documented, the template generated code probably won't work. The easiest way to create ABC Compliant Classes is to derive classes from the ABC Library–this is what the ABC Templates do. See CLASS in the Language Reference for more information on deriving classes.
Requirements for ABC Compliant Classes
·Classes must conform to the ABC Library specification as documented in the ABC Library Reference
·The header file containing the CLASS declarations must have the .INC file extension
·The header file (.INC) containing the CLASS declarations must be in Clarion's \LIBSRC directory
·The header file (.INC) containing the CLASS declaration must contain the following comment before compilable code begins:
!ABCIncludeFile
There is an optional parameter that can be added to the !ABCIncludeFile comment:
!ABCIncludeFile(familyclass)
familyclass is a string (no quotes) that contains a Class Name used to populate the %pClassCategory built-in template symbol. If absent, 'ABC' is used (no quotes).
The %pClassCategory is used throughout the templates for debugging, code declarations, and documentation of template prompts.
·The CLASS declarations must have the LINK attribute naming the corresponding implementation (.CLW) files.
Meeting these requirements ensures that your ABC Compliant Classes appear in the Application Builder Class Viewer, the Embeditor, the Embedded Source dialog, and that the development environment has full information about your classes. With this information, the development environment can correctly manage embed points and code generation for the compliant classes.
The OMIT compiler directive is ignored by the ABC Class Parser. To force a CLASS to be removed from processing, you need to use exclamation points around the code block.
EXTENDS and FINAL
During the processing of the ABC header files, there are two special parameters that can be added to methods defined within Classes that control their presence in the Template Source Embed tree interface (only found in the Application Generator).
These attributes must be preceded with !, (exclamation point followed by a comma) and no spaces between. For example:
Init PROCEDURE(BYTE Controls) !,EXTENDS
Throw PROCEDURE(SHORT Id),BYTE,PROC !,EXTENDS
Release PROCEDURE !,FINAL
By default, all public methods defined will not be visible in the embed tree. For example:
MyMethod PROCEDURE()
The reason for this is to optimize embed processing and eliminate embed points not needed.
If you need to make a public method visible in the embed tree, the EXTENDS symbol is added as follows:
MyMethod PROCEDURE() !,EXTENDS
Virtual methods are always visible in the embed tree. If you want to remove (hide) them from the embed tree , the FINAL symbol is added as follows:
MyMethod PROCEDURE() !,FINAL
In addition to this, Construct and Destruct are special methods that are automatically called for you when an object is instantiated and destroyed respectively. They will always appear on the embed tree in a different color.
Construct PROCEDURE()
Destruct PROCEDURE()
Finally, methods designated as PRIVATE are never visible in the embed tree as they cannot be overridden.