Chapter Contents

Previous

Next
SAS/AF Software: Class Dictionary

Using the Text Model Template Class

Use the Text Model Template class to create a custom model when you want to display text from a source that cannot use either an external file model or a catalog entry model. The external file model allows the text viewer to look at the contents of an external file and the catalog entry model allows the text viewer to look at the contents of a catalog entry. These models, which are subclasses of the Text Model Template class, are described in the Catalog Entry Model class and the External File Model class.

If you want to expand the functionality of either of these models, subclass that model directly and override only the methods you want to modify.

If you are making a model to view a different type of data, subclass the Text Model Template class. In this case, define all of the methods for the class to provide the functionality specific to your data.


Example: Creating a Custom Model by Subclassing the Text Model Template

This example creates a model that, when connected with a text viewer, displays the contents of a LIST or SLIST catalog entry:

  1. Create a new CLASS entry for the List Model class by entering this command:
    build sasuser.textview.list_m.class

    LIST_M.CLASS is the name of the List Model subclass. Set the parent class to SASHELP.FSP.GCONTROL, the name of the Text Model class. LIST_M.CLASS will inherit methods from SASHELP.FSP.GCONTROL.CLASS.

  2. Override the text model methods. All of the methods documented for this class need to be overridden by LIST_M.CLASS, since these methods are just templates and do not perform any operations yet.

  3. Specify the List Model class instance variables:

  4. Provide the SCL code for the List Model class methods:

  5. Create an attributes window for the List Model class. The List Model class needs its own attributes window so that the user making a text viewer connected to the list model can specify which list they would like to view. The name of the attributes window, SASUSER.TEXTVIEW.ATTRLIST.FRAME, was specified in the ATTR instance variable in step 3.

  6. Use the new list model:


Instance Variable for Text Model Subclasses

Instance variables inherited from the object class are described in the Object class.

When you subclass the Text Model Template class, add an instance variable called ATTR if your subclass has an attributes window.

ATTR
the attributes window name. If your model needs to ask the user for information, you can provide an attributes window for your model. If you specify an attributes window, it will come up when your class is selected in the Text Viewer Attributes window and the user selects Data class attributes.


FOOTNOTE 1:  Although it is not documented, the Generic Combo Box class is shipped with SAS/AF software and can be used as shown in this example. [arrow]


Chapter Contents

Previous

Next

Top of Page

Copyright 1999 by SAS Institute Inc., Cary, NC, USA. All rights reserved.