cdk_entry(3)
okay bestie come sit with me, we're doing cdk_entry(3) from the Library calls manual section and honestly? it's giving main character energy β¨
πΈ NAME πΈ
cdk_entry β the Cdk text-entry widget π
Like, it's a box. You type in it. That's the whole vibe.
π SYNOPSIS π
First things first, you gotta link against the library and pull in the header, no cap:
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
Then here's the cast of characters, and yes every single one of them is here because we do not skip anybody π
The ones that make it go brrr:
char *activateCDKEntry (
CDKENTRY *entry,
chtype *actions);
void cleanCDKEntry (
CDKENTRY *entry);
void destroyCDKEntry (
CDKENTRY *entry);
void drawCDKEntry (
CDKENTRY *entry,
boolean box);
void eraseCDKEntry (
CDKENTRY *entry);
The getters (they get. they literally just get):
boolean getCDKEntryBox (
CDKENTRY *entry);
chtype getCDKEntryFillerChar (
CDKENTRY *entry);
chtype getCDKEntryHiddenChar (
CDKENTRY *entry);
int getCDKEntryMax (
CDKENTRY *entry);
int getCDKEntryMin (
CDKENTRY *entry);
char *getCDKEntryValue (
CDKENTRY *entry);
The ones that poke it and move it around:
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,
const char *title,
const char *label,
chtype fieldAttribute,
chtype fillerCharacter,
EDisplayType displayType,
int fieldWidth,
int minimumLength,
int maximumLength,
boolean box,
boolean shadow);
And the setters, aka the glow-up squad π¦ (there are SO many, and we love that for them):
void positionCDKEntry (
CDKENTRY *entry);
void setCDKEntry (
CDKENTRY *entry,
const char *value,
int minimumLength,
int maximumLength,
boolean box);
void setCDKEntryBackgroundAttrib (
CDKENTRY *entry,
chtype attribute);
void setCDKEntryBackgroundColor (
CDKENTRY *entry,
const 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,
const char *value);
void setCDKEntryVerticalChar (
CDKENTRY *entry,
chtype character);
π DESCRIPTION π
So the Cdk entry widget is literally this: it creates a text-entry box with a label and an entry field πΈ Like, a label that says what it is, and a field where the typing happens. Iconic. No notes.
And the functions listed above? Those are the ones that create the Cdk entry box widget and manipulate it. That's the whole squad π«Ά
okay bestie stay with me, there's more coming β this page is long and we're only on part 1 π
β¨ AVAILABLE FUNCTIONS β¨
okay bestie, this is the good part β every single function this widget ships with, and what it does. no skipping, no skimming, we're doing all of them π
activateCDKEntryβ wakes the entry widget up and lets the user actually play with it.- the parameter entry is a pointer to a non-NULL entry widget.
- if the actions parameter gets passed a non-NULL value, the characters sitting in that array get injected straight into the widget.
and if you wanna activate it interactively instead? just pass a NULL pointer for actions.
okay so here's the vibe check on what comes back: if the character entered into this widget is RETURN or TAB, this function returns a char * representing the information typed into the widget, and the widget data exitType gets set to vNORMAL β¨
but if the character entered was ESCAPE? the function returns a NULL pointer and the widget data exitType is set to vESCAPE_HIT. bye bye π
cleanCDKEntryβ wipes the info right out of the field. squeaky clean π§ΌdestroyCDKEntryβ takes the widget off the screen and frees the memory the object was using. it's giving full cleanup energy.drawCDKEntryβ draws the entry widget on the screen.
if the box parameter is true, the widget gets drawn with a box around it π
eraseCDKEntryβ removes the widget from the screen. and listen β this does NOT destroy the widget. it's just hiding, not gone, bestie.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. the tea β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.
now the return value and the side-effect (aka setting the widget data exitType) both depend on which character you injected:
RETURNorTABβ the function returns achar *representing the information typed into the widget. the widget dataexitTypeis set tovNORMAL.ESCAPEβ the function returns aNULLpointer. the widget dataexitTypeis set tovESCAPE_HIT.- Otherwise β unless it's been modified by preprocessing, postprocessing or key bindings, the function returns a
NULLpointer. the widget dataexitTypeis set tovEARLY_EXIT.
moveCDKEntryβ moves the given widget to the given position.- the parameters xpos and ypos are the new position of the widget.
xpos may be an integer or one of the pre-defined values TOP, BOTTOM, and CENTER.
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.
like, for example, if xpos = 1 and ypos = 2 and relative = TRUE, then the widget would move one row down and two columns right. but if the value of relative was FALSE, then the widget would move to the position (1,2).
do NOT use the valuesTOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE. (weird things may happen). fr fr, we warned you π
- 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, in order:- 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, andCENTER. - 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, andCENTER. - 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. no widget, no vibes π
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. seecdk_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
newCDKEntryfunction.
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 β¨
Okay bestie, when this widget gets activated, there are several default key bindings that help you enter or manipulate the information quickly. The following table outlines the keys and their actions for this widget. Periodt.
Left Arrowβ Moves the cursor to the left. classic πCTRL-Bβ Moves the cursor to the left. same energyRight Arrowβ Moves the cursor to the right. β‘οΈCTRL-Fβ Moves the cursor to the right. twinningDeleteβ Deletes the character at the cursor. bye boo πBackspaceβ Deletes the character before cursor, moves cursor left. two-for-oneCTRL-Vβ Pastes whatever is in the paste buffer, into the widget. clipboard glow up β¨CTRL-Xβ Cuts the contents from the widget and saves a copy in the paste buffer. snip snip, savedCTRL-Yβ Copies the contents of the widget into the paste buffer. dupe it, queen πCTRL-Uβ Erases the contents of the widget. clean slate literallyCTRL-Aβ Moves the cursor to the beginning of the entry field. home sweet home πCTRL-Eβ Moves the cursor to the end of the entry field. end of an eraCTRL-Tβ Transposes the character under the cursor with the character to the right. swappy swap πReturnβ Exits the widget and returns achar *representing the information which was typed into the field. It also sets the widget dataexitTypetovNORMAL. main character exitTabβ Exits the widget and returns achar *representing the information which was typed into the field. It also sets the widget dataexitTypetovNORMAL. same exit, different keyEscapeβ Exits the widget and returns aNULLpointer. It also sets the widget dataexitTypetovESCAPE_HIT. peace out with a NULLCtrl-Lβ Refreshes the screen. visual reset, slay
π SEE ALSO π
Go read these too, bestie β theyβre all in the same friend group:
Thatβs the whole tea! This was cdk_entry(3), dated 2025-01-14. Stay iconic, bestie πβ¨
π¦ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 Β· BSD-4-Clause
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 43: cdk 5.0.20251014-1.fc43 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- fedora 44: cdk 5.0.20251014-3.fc44 Β· X11-distribute-modifications-variant
- nixos 26.05: cdk 5.0-20260119
- nixpkgs unstable: cdk 5.0-20260119
- ubuntu questing: libcdk5-dev 5.0.20250116-1
- ubuntu resolute: libcdk5-dev 5.0.20251014-1 Β· BSD-4-Clause
- ubuntu stonking: libcdk5-dev 5.0.20260119-1 Β· BSD-4-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms