DOKK / manpages / debian 11 / libcdk5-dev / setCDKTemplateBackgroundColor.3.en
cdk_template(3) Library Functions Manual cdk_template(3)

cdk_template - a curses template widget.

cc [ flag ... ] file ... -lcdk [ library ... ]

#include <cdk.h>

CDKTEMPLATE *template,
chtype * actions);
CDKTEMPLATE *template);
CDKTEMPLATE *template);
CDKTEMPLATE *template,
boolean box);
CDKTEMPLATE *template);
CDKTEMPLATE *template);
CDKTEMPLATE *template);
CDKTEMPLATE *template);
CDKTEMPLATE *template,
chtype input);
CDKTEMPLATE *template);
CDKTEMPLATE *template,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
const char *title,
const char *label,
const char *plate,
const char *overlay,
boolean box,
boolean shadow);
CDKTEMPLATE *template);
CDKTEMPLATE *template,
const char *value,
boolean box);
CDKTEMPLATE *template,
chtype attribute);
CDKTEMPLATE *template,
const char * color);
CDKTEMPLATE *template,
boolean box);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
TEMPLATECB callbackFunction);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
int minimum);
CDKTEMPLATE *template,
PROCESSFN callback,
void * data);
CDKTEMPLATE *template,
PROCESSFN callback,
void * data);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
const char *value);
CDKTEMPLATE *template,
chtype character);
CDKTEMPLATE *template,
const char *string);

The Cdk template widget creates a template widget which allows a user to type information into an entry field with a pre-set field format. Typical uses for this widget would be a date field or a time field. The following are functions which create or manipulate the Cdk template box widget.

activates the template widget and lets the user interact with the widget.
  • The parameter template is a pointer to a non-NULL template widget.
  • If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget.
To activate the widget interactively pass in a NULL pointer for actions.
If the character entered into this widget is RETURN or TAB then this function will return a char * representing the information typed into the widget and the widget data exitType will be set to vNORMAL.
If the character entered was ESCAPE then the function will return NULL pointer and the widget data exitType is set to vESCAPE_HIT.
clears the information from the field.
removes the widget from the screen and frees any memory the object used.
draws the template widget on the screen. If box is true, the widget is drawn with a box.
removes the widget from the screen. This does NOT destroy the widget.
returns true if the widget will be drawn with a box around it.
returns the minimum characters that must be entered before the widget will exit.
returns the current value of the widget.
injects a single character into the widget.
  • The parameter template is a pointer to a non-NULL template widget.
  • The parameter character is the character to inject into the widget.
The return value and side-effect (setting the widget data exitType) depend upon the injected character:
the function returns a char * representing the information typed into the widget. The widget data exitType is set to vNORMAL.
the function returns a NULL pointer. The widget data exitType is set to vESCAPE_HIT.
unless modified by preprocessing, postprocessing or key bindings, the function returns a NULL pointer. The widget data exitType is set to vEARLY_EXIT.
returns a char* pointer to the field value and the plate.
moves the given widget to the given position.
The parameters xpos and ypos are the new position of the widget.
The parameter xpos is an integer or one of the predefined values TOP, BOTTOM, and CENTER.
The parameter ypos may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
The parameter relative states whether the xpos/ypos pair is a relative move or an absolute move.
For example, if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. If the value of relative was FALSE then the widget would move to the position (1,2).
Do not use the values TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE (weird things may happen).
The final parameter refresh is a boolean value which states whether the widget will be repainted after the move.
creates a template widget, returning a pointer to it. Parameters:
is the screen you wish this widget to be placed in.
controls the placement of the object along the horizontal axis. It may be an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
controls the placement of the object along the vertical axis. It may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
is the string to display at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break.
is the string to display in the label of the template field.
defines the character to allow at each position in the template field. This is done by creating a character plate by using special format character to tell the template widget what type of character is allowed where in the template widget. The following table lists the format types.

Plate_Character Effect
# Accepts an integer.
A Accepts an alphabetic value.
C Accepts an alphabetic value. Automatically converts the character to upper case.
c Accepts an alphabetic value. Automatically converts the character to lower case.
M Accepts alphanumeric characters.
X Accepts alphanumeric characters. Automatically converts the character to upper case.
x Accepts alphanumeric characters. Automatically converts the character to upper case.
Anything else Ignored and assumed a non-editable position.
is the overlay of the template field. If the field needs some sort of overlay, this parameter supplies this. A date field could have YY/MM/DD, the overlay parameter would display YY/MM/DD on an empty template field.
is true if the widget should be drawn with a box around it.
turns the shadow on or off around this widget.
If the widget could not be created then a NULL pointer is returned.
allows the user to move the widget around the screen via the single keystroke commands. See cdk_position (3) for key bindings.
lets the programmer modify certain elements of an existing template widget.
The parameter names correspond to the same parameter names listed in the newCDKTemplate function.
sets the background attribute of the widget.
The parameter attribute is a curses attribute, e.g., A_BOLD.
sets the background color of the widget.
The parameter color is in the format of the Cdk format strings.
For more information, see the cdk_display (3).
sets a flag, true if the widget will be drawn with a box around it.
sets the attribute of the box.
allows the programmer to set a different widget input handler.
The parameter callbackFunction is of type TEMPLATECB.
The default input handler is CDKTemplateCallBack.
sets the horizontal drawing character for the box to the given character.
sets the lower left hand corner of the widget's box to the given character.
sets the lower right hand corner of the widget's box to the given character.
sets the minimum number of characters that must be entered before the widget will exit.
allows the user to have the widget call a function after the key has been applied to the widget. To learn more about post-processing see cdk_process (3).
allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. To learn more about preprocessing see cdk_process (3).
sets the upper left hand corner of the widget's box to the given character.
sets the upper right hand corner of the widget's box to the given character.
sets a value in the widget.
sets the vertical drawing character for the box to the given character.
returns a char* pointer to the field value without any plate characters.

When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. The following table outlines the keys and their actions for this widget.

Key Action
Delete Deletes the character at the cursor.
Backspace Deletes the character before cursor, moves cursor left.
Ctrl-P Pastes whatever is in the paste buffer, into the widget.
Ctrl-K Cuts the contents from the widget and saves a copy in the paste buffer.
Ctrl-T Copies the contents of the widget into the paste buffer.
Ctrl-E Erases the contents of the widget.
Return Exits the widget and returns a char* representing the information which was typed into the field. It also sets the widget data exitType to vNORMAL.
Tab Exits the widget and returns a char* representing the information which was typed into the field. It also sets the widget data exitType to vNORMAL.
Escape Exits the widget and returns a NULL pointer. It also sets the widget data exitType to vESCAPE_HIT.
Ctrl-L Refreshes the screen.

cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)