Adding New Logical Attributes

Designer: You can add new logical attributes to the logical attribute table used by your Designer library. See the Designer User's Guide for more information. You can also add new attributes to the system logical attribute table. These new attributes will not be available to your Designer forms unless you replace or modify the logical attribute table used by the Designer library.

Code: As supplied, the system logical attribute table defines 27 logical attributes and reserves space for 16 more. You can add as many logical attributes as you wish onto the end of this table.

Warning: The logical attribute table currently has 43 logical attributes. If you use any of these positions to define new logical attributes, you may conflict with definitions used within the system at some point in time.

To add a logical attribute, you need to take 3 steps: (1) #define the name for the new attribute, (2) change the parameter for the number of logical attributes, and (3) add the logical attribute to the logical attribute table.

As an example, we will go through these steps by creating the logical attribute LSTATUS.

Step 1: Define a logical attribute name.

Logical attribute names are #defined in vv_sys.h. Edit this file and go to the last entry. The last two entries currently read:

#define LAVR15         41 /* reserved logical attribute     */

#define LAVR16        42 /* reserved logical attribute    */

Add the new entry to the end and give it the next number in the sequence.

#define LAVR15        41 /* reserved logical attribute        */

#define LAVR16        42 /* reserved logical attribute        */

#define LSTATUS        43 /* logical status line attribute        */

There is a limit of 256 logical attributes.

Step 2: Change the number of logical attributes.

The number of logical attributes is #defined as LATTQ in vv_sys.h. This is originally set to 43, since there are 43 logical attributes defined (numbered 0-42). There are now 44 logical attributes, so change the #defined value of LATTQ to 44. The line should now read:

#define LATTQ 44 /* number of logical attributes*/

Step 3: Add the new definition to the logical attribute table.

To add the new definition, edit file vv_main.h and go to the bottom of _att_tbl[ ][ ], which now reads:

{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0}  /*  RESERVED        */

and add the physical attributes you want to use for LSTATUS. In the example, we use REVERSE for monochrome and BLUE on CYAN for color modes. The last two lines now read:

{0, 0}, {0, 0}, {0, 0}, {0, 0}, {0, 0},         /* RESERVED    */

{REVERSE, catt_def(BLUE, CYAN)}              /* LSTATUS    */

Note that a comma has been appended to the last element in the array before adding the new one. The last element is not terminated by a comma.

Using a Logical Attribute Created in the Designer

If you define a new logical attribute using the Designer, you can use that logical attribute in your application. For the name of each new attribute, you have to provide a #define. The last attribute in the standard Designer library table is LSPINCH. When you define new attributes, place them in consecutive slots labeled UNDEFINED following LSPINCH. Then, in your applcation code, include #defines like the following:

#define LMY_1ST_ATT VCSLATTQ

#define LMY_2ND_ATT VCSLATTQ + 1

where the names you define are the same as those you entered at the bottom of the Designer color table.


Home Contents Previous Next