cl_def()

Allocates and initializes a choice list

Call  
#include <vv_clist.h>
CLISTPTR cl_def(rb, cb, rowq, colq, bdrp, kwdp, mfp)

int rb

Screen row to begin the choice list window

int cb Screen column to begin the choice list window
int rowq Number of rows in the choice list window
int colq Number of columns in the choice list window
BORDERPTR bdrp Pointer to border to use for the choice list window
UCHAR *kwdp Keyword marking choice list in memory file
MFILEPTR mfp Memory file containing the choice list
Description of Parameters

rb, cb: Screen rows and columns are based on an origin of (0,0).

rowq, colq: When specifying the number of rows and columns of the choice list, take into account the rows and columns needed for the border characters and the window margins. Window margins are set by default to 0.

bdrp: Specify a border pointer. The following border pointers are defined. Appearance is operating system dependent.

BDR_NULLP No border
BDR_SLNP Single-line border
BDR_DLNP Double-line border
BDR_SPACEP Space character border
BDR_DOTP Stippled block graphics character or dot/colon border
BDR_STARP Asterisk border
BDR_SOLIDP Solid block graphics character or space border
kwdp: Specify the keyword (including the special keyword character) for the section of the memory file that contains the choice list. Specify NULLP if the memory file contains only a single choice list and has no keywords.
Returns
CLISTPTR A pointer to the choice list structure
NULLP Error. VV_ERR is set to the following:

  MEMLACK There is insufficient memory to allocate a choice list structure and a window structure.
Description

Before calling this function, you must have defined a memory file with mf_def(). The memory file must contain the text for each item in the choice list, one item per line in the memory file. If using a keyword for the choice list, the keyword must also be placed on its own line in the memory file to mark the beginning of the choice list items.

cl_def() makes one call to mem_get() to allocate memory for the choice list structure and the window associated with the choice list. The choice list structure members are then set to the following defaults:

  • The active attribute is set to LCLACT.

  • The length of the highlight bar is set to the width of the window minus any spaces needed for the border characters and the margins.

  • The choice list options are all set to OFF.

  • The number of the choice list item to be highlighted when the choice list is displayed is set to 0.T

  • The help for the choice list is set to NULLP.

A window structure for the choice list is created by duplicating the default choice list window CLIST_WNP. The window is then changed to have the beginning row and column, number of rows and columns, border pointer and memory file pointer specified in the call. The CLIST_WNP window attribute is set by default to LCLINACT, which is also the default attribute for the border attribute and the window title attribute.

The inactive attribute for the choice list items is the choice list window attribute, LCLINACT by default.

Related Functions

mf_def(), cl_free()

Cautions

A memory file must be declared and initialized before calling cl_def(). Each choice list item must be on one line and must begin in the first column.


Home Contents Previous Next