OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Creating Document Registration Tables

After you have defined a template class, you can create any number of instances of that class.

You can use template class instances to provide different descriptions of a template, search for different default file names, look in different default directories, and so on. Each of these attributes of a template class instance is affected by the document registration table passed to the template class constructor.

Document registration tables let you specify the various attributes and place them in a single object. The object type is TRegList, although in normal circumstances, you should never have to access this object directly. To create a registration table,

  1. Start your registration table definition with BEGIN_REGISTRATION. This macro takes a single parameter, the name of the registration object. This name can be whatever you want it to be, although it should be somewhat descriptive of the particular template instance you want to create with it.
  2. Register data items in the table. You can place these items in the table using the REGDATA macro. REGDATA takes two parameters. The first is a key that identifies the type of data, while the second is a string containing the actual data. The key should be a string composed of alphanumeric characters; you don't need to place quotes around this value. The actual data string can be any legal string; you do need to place quotes around this value. Also, you don't need to use commas or semicolons after the macros. There are three data items you need to enter in the table for an instance of a document template:
    • The description value is a short text description of the template class indicates the type of data handled by the document class and how that data is displayed by the view class.
    • The extension value indicates the default file extension for documents of this type.
    • The docfilter value indicates the file name masks that should be applied to documents when searching through file names.
  3. Register flags describing how this document type is to be opened or created. These document flags can be registered with the REGDOCFLAGS macro. REGDOCFLAGS takes a single parameter, the flags themselves. The flags specified can be one or more of the following:
    FlagFunction
    dtAutoDeleteClose and delete the document object when the last view is closed.
    dtNoAutoViewDo not automatically create a default view.
    dtSingleViewAllow only one view per document.
    dtAutoOpenOpen a document upon creation.
    dtHiddenHide template from list of user selections.
  4. After you have registered the necessary data items and the document mode flags, you can end the table definition with the END_REGISTRATION macro. This macro takes no parameters. You do not need to append a semicolon at the end to the line.

Example

The code below shows a sample registration table declaration. The resulting registration table is called ListReg and applies to a document template class described as a Line List, which has the default extension .PTS and the default file-name mask *.pts, is set to be automatically deleted when the last view on the document is closed, and is hidden from the list of documents available to the user.

REGDATA(description,"Line List")
REGDOCFLAGS(dtAutoDelete | dtHidden)
#define REGDATA(var, val)
Definition registry.h:591
#define REGDOCFLAGS(i)
Definition registry.h:598
#define BEGIN_REGISTRATION(regname)
Definition registry.h:583
#define END_REGISTRATION
Definition registry.h:589

See Also