DOKK / manpages / debian 12 / libcdk5-dev / positionCDKAlphalist.3.en
cdk_alphalist(3) Library Functions Manual cdk_alphalist(3)

cdk_alphalist - curses sorted list widget.

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

#include <cdk.h>

CDKALPHALIST *alphalist,
chtype *actions);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist,
boolean box);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist,
int *size);
CDKALPHALIST *widget);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist,
chtype input);
CDKALPHALIST *alphalist,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
int height,
int width,
const char * title,
const char * label,
CDK_CONST char ** list,
int listSize,
chtype fillerCharacter,
chtype highlight,
boolean box,
boolean shadow);
CDKALPHALIST *alphalist);
CDKALPHALIST *alphalist,
CDK_CONST char ** list,
int listSize,
chtype fillerCharacter,
chtype highlight,
boolean box);
CDKALPHALIST *alphalist,
chtype attribute);
CDKALPHALIST *alphalist,
const char * color);
CDKALPHALIST *alphalist,
boolean box);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
CDK_CONST char ** list,
int listSize);
CDKALPHALIST *widget,
int item);
CDKALPHALIST *alphalist,
chtype fillerCharacter);
CDKALPHALIST *alphalist,
chtype highlight);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
PROCESSFN callback,
void * data);
CDKALPHALIST *alphalist,
PROCESSFN callback,
void * data);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
chtype character);
CDKALPHALIST *alphalist,
chtype character);

The Cdk alphalist allows a user to select from a list of alphabetically sorted words. The user can use the arrow keys to traverse through the list or type in the beginning of the word and the list will automatically adjust itself in the correct place in the scrolling list. This widget, like the file selector widget, is a compound widget of both the entry field widget and the scrolling list widget.

activates the alphalist widget and lets the user interact with the widget.
  • The parameter alphalist is a pointer to a non-NULL alphalist 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 then this function will return a char * of the information which was typed in the field.
If the TAB character is hit then the widget will try to complete the word in the entry field.
If the widget is exited with the RETURN character then the widget data exitType will be set to vNORMAL.
If the widget was exited with the ESCAPE key then the widget data exitType will be set to vESCAPE_HIT and the widget returns NULL.
removes the widget from the screen and frees memory the object used.
draws the alphalist widget on the screen.
If the box parameter 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 contents of the alphalist.
returns the current position in the scroll-widget.
returns the character being used as the filler character in the entry field portion of the widget.
returns the attribute of the highlight bar of the scrolling list portion of the widget.
injects a single character into the widget (actually the entry widget).
  • The parameter alphalist is a pointer to a non-NULL alphalist 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 the information in the entry field. 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.
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.
creates a pointer to an alphalist widget. Parameters:
  • screen is the screen you wish this widget to be placed in.
  • xpos controls the placement of the object along the horizontal axis. This parameter can take an integer or one of the pre-defined values LEFT, RIGHT, and CENTER.
  • ypos controls the placement of the object along the vertical axis. This parameter may be an integer value or one of the pre-defined values TOP, BOTTOM, and CENTER.
  • height and width control the height and width of the widget. If you provide a value of zero for either of the height or the width, the widget will be created with the full width and height of the screen. If you provide a negative value, the widget will be created the full height or width minus the value provided.
  • title is the string which will be displayed at the top of the scrolling list. 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.
  • list is the list of words which will be displayed in the scrolling list. This list does not have to be sorted, this widget automatically sorts the list (note that it modifies the caller's copy of the list to do this).
  • listSize tells the widget how large the word list is.
  • fillerCharacter is the character which is to be displayed in an empty space in the entry field.
  • highlight is the attribute of the highlight bar in the scrolling list.
  • box is true if the widget should be drawn with a box around it.
  • shadow is true to turn the shadow on 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 cursor/keypad keys. See cdk_position (3) for key bindings.
lets the programmer modify certain elements of an existing alphalist widget.
The parameter names correspond to the same parameter names listed in the newCDKAlphalist 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. See cdk_display (3).
sets whether the widget will be drawn with a box around it.
sets the attribute of the box.
sets the contents of the alphalist widget (note that it sorts the caller's copy of the list).
set the current position in the scroll-widget.
sets the character to use when drawing the entry field portion of the widget.
sets the attribute of the highlight bar of the scrolling list portion of the widget.
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.
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).
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).
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 the vertical drawing character for the box to the given character.

When the widget is activated there are several default key bindings which will help the user enter or manipulate the information quickly. Since this widget is built from both the scrolling list widget and the entry field widget, the key bindings are the same for the respective fields. The extra key bindings are listed below.

Key Action
Up Arrow Scrolls the scrolling list up one line.
Down Arrow Scrolls the scrolling list down one line.
Page Up Scrolls the scrolling list up one page.
CTRL-B Scrolls the scrolling list up one page. Page Down/Scrolls the scrolling list down one page.
CTRL-F Scrolls the scrolling list down one page.
Tab Tries to complete the word in the entry field. If the word segment is not unique then the widget will beep and present a list of close matches.
Return Returns the word in the entry 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.

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

This widget is created from the scrolling list widget and the entry field widget. This is a good example on how to build your own widgets using the base widgets provided in this distribution.