Fields contain multiple classes. Each class is a single element representing a feature of Field Visualization. It is through the creation of these classes that you will access the various features of Field Visualization. For example, to visualize a field as a SpinEdit on a Form then a SpinEdit class (PRIM_EVSE) will be added to the Field Class List in the Field Component source.
Visualization Classes
These are the built in visualizations provided by LANSA through existing and new PRIM_'s. The following is the complete set of built in visualizations
Following is a small sample of the component code for a field that will be visualized as a SpinEdit:
Begin_Com Role(*EXTENDS #PRIM_OBJT)
Begin_Com Role(*Visual #PRIM_EVSE) Name(#SPINEDIT) DefaultVisual(True) Height(25) Width(270)
End_Com
End_Com
Reusable Part Visualization Classes
Further to the built in Visualizations it is possible to Visualize your fields as a reusable part that you have created. This is a powerful feature that will be used when the built in types do not offer enough flexibility. Here is some sample component code for a field visualized as a reusable part.
Begin_Com Role(*EXTENDS #PRIM_OBJT)
Begin_Com Role(*VISUAL_PART #PARTNAME) Name(#Custom) Defaultvisual(True) Height(108)
End_Com
End_Com
Prompter Classes
Prompters are another new feature of Field Visualization. However, they are not visualizations themselves. They are form components that will be used to retrieve a value for the field when activated. The prompter is to be used in conjunction with the LANSA Visualization classes or the PRIM_GRID (Grid), PRIM_LTVW (ListView) and PRIM_TRVW (Tree) controls. When visible the prompter can be accessed via the F4 key or by clicking on a button with the ellipses (eg … ). Samples are included below but for here is a sample Field Component source including a prompter form called PROMPTER. This source will make a prompter available for the VisualEdit visualization.
Begin_Com Role(*EXTENDS #PRIM_OBJT)
Begin_Com Role(*Visual #PRIM_EVEF) Name(#VisualEdit) Defaultvisual(True) Height(34) Usepicklist(False) Width(202)
End_Com
Begin_Com Role(*prompter #AFLDVIS0P) Name(#PROMPTER)
End_Com
End_Com
Picklist Classes
Picklists are another new feature of Field Visualization. Again, they are not visualizations themselves but are used in conjunction with other visualizations. A picklist is to be created when a field can contain only a predetermined set of values. One good example of this is a field called SEX. For this field it would be logical to create a picklist that contained two entries (one for Male and one for Female). These picklist values are then the only allowable visual values for that field.
Samples can be found below but once again here is the component source for a simple field called SEX that will be visualized as a picklist with a button set.
Begin_Com Role(*EXTENDS #PRIM_OBJT)
Begin_Com Role(*Visual #PRIM_EVPL) Name(#PICKLIST) Defaultvisual(True) Height(25) Width(270)
End_Com
Begin_Com Role(*picklist) Name(#LIST)
Define_Com Class(#PRIM_PKIT) Name(#ITEM1) Caption('Male') Default(True) Parent(#LIST) Value('M')
Define_Com Class(#PRIM_PKIT) Name(#ITEM2) Caption('Female') Parent(#LIST) Value('F')
End_Com
End_Com