NAME
cdk_entry - curses text-entry widget.
SYNOPSIS
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk/cdk.h>
char *activateCDKEntry (
CDKENTRY *entry,
chtype *actions);
void cleanCDKEntry (
CDKENTRY *entry);
void destroyCDKEntry (
CDKENTRY *entry);
void drawCDKEntry (
CDKENTRY *entry,
boolean box);
void eraseCDKEntry (
CDKENTRY *entry);
boolean getCDKEntryBox (
CDKENTRY *entry);
chtype getCDKEntryFillerChar (
CDKENTRY *entry);
chtype getCDKEntryHiddenChar (
CDKENTRY *entry);
int getCDKEntryMax (
CDKENTRY *entry);
int getCDKEntryMin (
CDKENTRY *entry);
char *getCDKEntryValue (
CDKENTRY *entry);
int injectCDKEntry (
CDKENTRY *entry,
chtype input);
void moveCDKEntry (
CDKENTRY *entry,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKENTRY *newCDKEntry (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
char *title,
char *label,
chtype fieldAttribute,
chtype fillerCharacter,
EDisplayType displayType,
int fieldWidth,
int minimumLength,
int maximumLength,
boolean box,
boolean shadow);
void positionCDKEntry (
CDKENTRY *entry);
void setCDKEntry (
CDKENTRY *entry,
char *value,
int minimumLength,
int maximumLength,
boolean box);
void setCDKEntryBackgroundAttrib (
CDKENTRY *entry,
chtype attribute);
void setCDKEntryBackgroundColor (
CDKENTRY *entry,
char * color);
void setCDKEntryBox (
CDKENTRY *entry,
boolean box);
void setCDKEntryBoxAttribute (
CDKENTRY *entry,
chtype character);
void setCDKEntryCB (
CDKENTRY *entry,
ENTRYCB callBackFunction);
void setCDKEntryFillerChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryHiddenChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryHighlight (
CDKENTRY *entry,
chtype highlight,
boolean cursor);
void setCDKEntryHorizontalChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryLLChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryLRChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryMax (
CDKENTRY *entry,
int maximum);
void setCDKEntryMin (
CDKENTRY *entry,
int minimum);
void setCDKEntryPostProcess (
CDKENTRY *entry,
PROCESSFN callback,
void * data);
void setCDKEntryPreProcess (
CDKENTRY *entry,
PROCESSFN callback,
void * data);
void setCDKEntryULChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryURChar (
CDKENTRY *entry,
chtype character);
void setCDKEntryValue (
CDKENTRY *entry,
char *value);
void setCDKEntryVerticalChar (
CDKENTRY *entry,
chtype character);
DESCRIPTION
The Cdk entry widget creates a text-entry box with a label and an entry
field. The following functions create or manipulate the Cdk entry box
widget.
AVAILABLE FUNCTIONS
activateCDKEntry
activates the entry widget and lets the user interact with the
widget. The parameter entry is a pointer to a non-NULL entry
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.
cleanCDKEntry
clears the information from the field.
destroyCDKEntry
removes the widget from the screen and frees memory the object
used.
drawCDKEntry
draws the entry widget on the screen. If the box parameter is
true, the widget is drawn with a box.
eraseCDKEntry
removes the widget from the screen. This does NOT destroy the
widget.
getCDKEntryBox
returns true if the widget will be drawn with a box around it.
getCDKEntryFillerChar
returns the character being used to draw unused space in the
widget.
getCDKEntryHiddenChar
returns the character being used to draw the hidden character
type.
getCDKEntryMax
returns the maximum length of a string the widget will allow.
getCDKEntryMin
returns the minimum length of a string the widget will allow.
getCDKEntryValue
returns the current value of the widget.
injectCDKEntry
injects a single character into the widget. The parameter entry
is a pointer to a non-NULL entry 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:
RETURN or TAB
the function returns a char * representing the information
typed into the widget. The widget data exitType is set to
vNORMAL.
ESCAPE the function returns a NULL pointer. The widget data
exitType is set to vESCAPE_HIT.
Otherwise
unless modified by preprocessing, postprocessing or key
bindings, the function returns a NULL pointer. The widget
data exitType is set to vEARLY_EXIT.
moveCDKEntry
moves the given widget to the given position. The parameters xpos
and ypos are the new position of the widget. The parameter xpos
may be an integer or one of the pre-defined 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 get refreshed after the
move.
newCDKEntry
creates a pointer to an entry widget. Parameters:
The screen parameter
is the screen you wish this widget to be placed in.
xpos 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.
ypos 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.
title
is the string which will be displayed at the top of the
widget. The title can be more than one line; just provide a
carriage return character at the line break.
label
is the string which will be displayed in the label of the
entry field.
fieldAttribute
is the attribute of the characters which are typed in.
filler
is the character which is to be displayed in an empty space
in the entry field.
displayType
tells how the entry field will behave when a character is
entered into the field. See cdk_display (3) for valid values
for this field.
fieldWidth
denotes the width of the field. If a value of zero is
provided, the field will be made as wide as possible on the
screen. If a negative value is given, then the field width
will be the maximum width minus the value provided.
minimumLength
controls the number of characters which must be entered
before the user can exit the entry field.
maximumLength
sets the maximum number of characters that can be entered.
box is true if the widget should be drawn with a box around it.
shadow
turns the shadow on around this widget.
If the widget could not be created then a NULL pointer is
returned.
positionCDKEntry
allows the user to move the widget around the screen via the
cursor/keypad keys. The following key bindings can be used to
move the widget around the screen. See cdk_position (3) for key
bindings.
setCDKEntry
lets the programmer modify certain elements of an existing entry
widget. The value parameter sets the value of the contents of the
entry field. The other parameter names correspond to the same
parameter names listed in the newCDKEntry function.
setCDKEntryBackgroundAttrib
sets the background attribute of the widget. The parameter
attribute is a curses attribute, e.g., A_BOLD.
setCDKEntryBackgroundColor
sets the background color of the widget. The parameter color is
in the format of the Cdk format strings. See cdk_display (3).
setCDKEntryBox
sets whether the widget will be drawn with a box around it.
setCDKEntryBoxAttribute
function sets the attribute of the box.
setCDKEntryCB
allows the programmer to set a different widget input handler.
The parameter callbackFunction is of type ENTRYCB. The default
function is CDKEntryCallBack.
setCDKEntryFillerChar
sets the character to use when drawing unused space in the field.
setCDKEntryHiddenChar
sets the character to use when using a hidden character type.
setCDKEntryHighlight
sets the attribute of the entry field.
setCDKEntryHorizontalChar
sets the horizontal drawing character for the box to the given
character.
setCDKEntryLLChar
sets the lower left hand corner of the widget’s box to the given
character.
setCDKEntryLRChar
sets the lower right hand corner of the widget’s box to the given
character.
setCDKEntryMax
sets the maximum length of the string that the widget will allow.
setCDKEntryMin
sets the minimum length of the string that the widget will allow.
setCDKEntryPostProcess
allows the user to have the widget call a function after the key
has been applied to the widget. The parameter function is the
callback function. The parameter data points to data passed to
the callback function. To learn more about post-processing see
cdk_process (3).
setCDKEntryPreProcess
allows the user to have the widget call a function after a key is
hit and before the key is applied to the widget. The parameter
function is the callback function. The parameter data points to
data passed to the callback function. To learn more about pre-
processing see cdk_process (3).
setCDKEntryULChar
sets the upper left hand corner of the widget’s box to the given
character.
setCDKEntryURChar
sets the upper right hand corner of the widget’s box to the given
character.
setCDKEntryValue
sets the current value of the widget.
setCDKEntryVerticalChar
sets the vertical drawing character for the box to the given
character.
KEY BINDINGS
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
----------------------------------------------------------------------
Left Arrow Moves the cursor to the left.
CTRL-B Moves the cursor to the left.
Right Arrow Moves the cursor to the right.
CTRL-F Moves the cursor to the right.
Delete Deletes the character at the cursor.
Backspace Deletes the character before cursor, moves cursor left.
CTRL-V Pastes whatever is in the paste buffer, into the
widget.
CTRL-X Cuts the contents from the widget and saves a copy in
the paste buffer.
CTRL-Y Copies the contents of the widget into the paste
buffer.
CTRL-U Erases the contents of the widget.
CTRL-A Moves the cursor to the beginning of the entry field.
CTRL-E Moves the cursor to the end of the entry field.
CTRL-T Transposes the character under the cursor with the
character to the right.
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.
----------------------------------------------------------------------
SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_position(3),
cdk_process(3), cdk_screen(3)
cdk_entry(3)