cdk_uslider(3)
okay bestie, buckle UP π what we have here is cdk_uslider from section 3 (Library calls) of the Cdk manual, and she is so main character. ngl this page is a whole trilogy, so this is part 1 β more coming, don't go anywhere π«Ά
β¨ NAME β¨
cdk_uslider β the Cdk slider widget, except make it unsigned π
no negative vibes allowed in this house
π SYNOPSIS π
cc [ flag ... ] file ... -lcdk [ library ... ]
#include <cdk.h>
int activateCDKUSlider (
CDKUSLIDER *slider,
chtype *actions);
void destroyCDKUSlider (
CDKUSLIDER *slider);
void drawCDKUSlider (
CDKUSLIDER *slider,
boolean box);
void eraseCDKUSlider (
CDKUSLIDER *slider);
boolean getCDKUSliderBox (
CDKUSLIDER *slider);
unsigned getCDKUSliderHighValue (
CDKUSLIDER *slider);
unsigned getCDKUSliderLowValue (
CDKUSLIDER *slider);
unsigned getCDKUSliderValue (
CDKUSLIDER *slider);
unsigned injectCDKUSlider (
CDKUSLIDER *slider,
chtype input);
void moveCDKUSlider (
CDKUSLIDER *slider,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKUSLIDER *newCDKUSlider (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
const char *title,
const char *label,
chtype fillerCharacter,
int fieldWidth,
int currentValue,
unsigned lowValue,
unsigned highValue,
unsigned increment,
unsigned fastIncrement,
boolean box,
boolean shadow);
void positionCDKUSlider (
CDKUSLIDER *slider);
void setCDKUSlider (
CDKUSLIDER *slider,
unsigned lowValue,
unsigned highValue,
unsigned currentValue,
boolean box);
void setCDKUSliderBackgroundAttrib (
CDKUSLIDER *slider,
chtype attribute);
void setCDKUSliderBackgroundColor (
CDKUSLIDER *slider,
const char * color);
void setCDKUSliderBox (
CDKUSLIDER *slider,
boolean boxWidget);
void setCDKUSliderBoxAttribute (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderHorizontalChar (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderLLChar (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderLRChar (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderLowHigh (
CDKUSLIDER *slider,
unsigned lowValue,
unsigned highValue);
void setCDKUSliderPostProcess (
CDKUSLIDER *slider,
PROCESSFN callback,
void * data);
void setCDKUSliderPreProcess (
CDKUSLIDER *slider,
PROCESSFN callback,
void * data);
void setCDKUSliderULChar (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderURChar (
CDKUSLIDER *slider,
chtype character);
void setCDKUSliderValue (
CDKUSLIDER *slider,
unsigned value);
void setCDKUSliderVerticalChar (
CDKUSLIDER *slider,
chtype character);
not me dropping a whole wall of prototypes on you first thing π« but fr fr, every single one of these is getting its own lil moment later, promise π
πΈ DESCRIPTION πΈ
okay so here's the tea β the Cdk slider widget makes a visual slider box β and it comes with a label plus a slider field, so it's giving very much "pretty AND functional", which we love ππ
and that's literally what all the functions on this page are here to do: create the Cdk slider box widget, or manipulate the Cdk slider box widget. those are the two jobs. she builds, she tweaks. periodt π
think of it like the group chat of widgets β one girl makes the plans, and the rest of them keep the plans from falling apart π¦β¨
and yes, bestie, there's way more where this came from π
π AVAILABLE FUNCTIONS π
bestie. this is the main character list right here. every single one of these is a function you can call. let's go π«Ά
activateCDKUSlider
okay so this one activates the slider widget and lets the user actually interact with it. hands on the wheel, main character moment β¨
- the parameter
slideris a pointer to a non-NULL slider widget. - if the
actionsparameter 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.
- to activate the widget interactively, pass in a NULL pointer for
if the character entered into this widget is RETURN or TAB then this function will return a value from the low value to the high value. it will also set the widget data exitType to vNORMAL. slay π
if the character entered into this widget was ESCAPE then the widget returns the unknownUnsigned value (see the cdk_objs.h header file). the widget data exitType is set to vESCAPE_HIT. we love a clean exit π
destroyCDKUSlider
removes the widget from the screen and frees the memory the object used. it's giving closure. π¦
drawCDKUSlider
draws the slider widget on the screen. if the box option is true, the widget is drawn with a box. β¨ iconic framing honestly
eraseCDKUSlider
removes the widget from the screen. this does NOT destroy the widget. just hiding it, not ghosting it forever π
getCDKUSliderBox
returns true if the widget will be drawn with a box around it. vibe check on the box situation π¦
getCDKUSliderHighValue
returns the high value of the slider widget. β¬οΈ
getCDKUSliderLowValue
returns the low value of the slider widget. β¬οΈ
getCDKUSliderValue
returns the current value of the widget. the moment. the truth. π
injectCDKUSlider
injects a single character into the widget. one char, big impact π₯
- the parameter
slideris a pointer to a non-NULL slider widget. - the parameter
characteris the character to inject into the widget.- the return value and side-effect (setting the widget data
exitType) depend upon the injected character:
- the return value and side-effect (setting the widget data
RETURN or TAB : the function returns a value ranging from the slider's low value to the slider's high value. the widget data exitType is set to vNORMAL.
ESCAPE : the function returns the unknownUnsigned value (see the cdk_objs.h header file). the widget data exitType is set to vESCAPE_HIT.
otherwise β unless modified by preprocessing, postprocessing or key bindings β the function returns the unknownUnsigned value (see the cdk_objs.h header file). the widget data exitType is set to vEARLY_EXIT.
moveCDKUSlider
moves the given widget to the given position. relocation era π§³
- the parameters
xposandyposare the new position of the widget.- the parameter
xposmay be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER. - the parameter
yposmay be an integer or one of the pre-defined valuesLEFT,RIGHT, andCENTER.
- the parameter
- the parameter
relativestates whether thexpos/ypospair is a relative move or an absolute move.- for example, if
xpos = 1andypos = 2andrelative = TRUE, then the widget would move one row down and two columns right. if the value ofrelativewasFALSE, then the widget would move to the position(1,2). - do not use the values
TOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE. (weird things may happen). fr fr, don't. π
- for example, if
- the final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
newCDKUSlider
this function creates a slider widget and returns a pointer to it. baby widget birth announcement πΆβ¨
parameters:
screenβ 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 valuesLEFT,RIGHT, andCENTER.yposβ controls the placement of the object along the vertical axis. it may be an integer or one of the pre-defined valuesTOP,BOTTOM, andCENTER.titleβ 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.labelβ is the string to display in the label of the slider field.fillerCharacterβ is the character to be used to draw the slider bar in the field.fieldWidthβ controls the width of the widget. if you provide a value of zero the widget will be created with the full width of the screen. if you provide a negative value, the widget will be created the full width minus the value provided.currentValueβ is the value of the slider field when the widget is activated.lowValueandhighValueβ are the low and high values of the widget respectively.incrementβ is the regular increment value.fastIncrementβ is the accelerated increment value.boxβ is true if the widget should be drawn with a box around it.shadowβ turns the shadow on or off around this widget.
if the widget could not be created then a NULL pointer is returned. π sad but true
positionCDKUSlider
allows the user to move the widget around the screen via the cursor/keypad keys. see cdk_position (3) for key bindings. drag it, drop it, it's yours π
setCDKUSlider
lets the programmer modify certain elements of an existing slider widget. the parameter names correspond to the same parameter names listed in the newCDKUSlider function. glow-up for an existing widget π
setCDKUSliderBackgroundAttrib
sets the background attribute of the widget.
the parameter attribute is a curses attribute, e.g., A_BOLD. β¨
setCDKUSliderBackgroundColor
sets the background color of the widget.
the parameter color is in the format of the Cdk format strings.
see cdk_display (3). π
setCDKUSliderBox
sets whether the widget will be drawn with a box around it. π¦
setCDKUSliderBoxAttribute
this function sets the attribute of the box.
setCDKUSliderHorizontalChar
sets the horizontal drawing character for the box to the given character. β
setCDKUSliderLLChar
sets the lower left hand corner of the widget's box to the given character. βοΈ
setCDKUSliderLRChar
sets the lower right hand corner of the widget's box to the given character. βοΈ
setCDKUSliderLowHigh
sets the low and high values of the widget.
setCDKUSliderPostProcess
allows the user to have the widget call a function after the key has been applied to the widget.
- the parameter
functionis the callback function. - the parameter
datapoints to data passed to the callback function.
to learn more about post-processing see cdk_process(3). π«Ά
setCDKUSliderPreProcess
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
functionis the callback function. - the parameter
datapoints to data passed to the callback function.
to learn more about pre-processing see cdk_process(3). π«Ά
setCDKUSliderULChar
sets the upper left hand corner of the widget's box to the given character. βοΈ
setCDKUSliderURChar
sets the upper right hand corner of the widget's box to the given character. βοΈ
setCDKUSliderValue
sets the current value of the widget. β
setCDKUSliderVerticalChar
sets the vertical drawing character for the box to the given character. β
β¨οΈ KEY BINDINGS β¨οΈ
ok so bestie, when the widget is activated (yes, activated, it's giving main character energy π ), there are a bunch of default key bindings that help the user type in or mess with the info super fast. no cap. here's the whole rundown of the keys and what they do for this widget β¨
Down Arrowβ decrements the field by the normal decrement value. down bad, but on purpose π«ΆUp Arrowβ increments the field by the normal increment value.uβ increments the field by the normal increment value.Prev Pageβ decrements the field by the accelerated decrement value. zoom zoom π¦Uβ decrements the field by the accelerated decrement value.Ctrl-Bβ decrements the field by the accelerated decrement value.Next Pageβ increments the field by the accelerated increment value.Dβ increments the field by the accelerated increment value.Ctrl-Fβ increments the field by the accelerated increment value.Homeβ sets the value to the low value. rock bottom, but make it iconic πgβ sets the value to the low value.Endβ sets the value to the high value. πGβ sets the value to the high value.$β sets the value to the high value.Returnβ exits the widget and returns the current value. this also sets the widget dataexitTypetovNORMAL. slay, clean exit πTabβ exits the widget and returns the current value. this also sets the widget dataexitTypetovNORMAL.Escapeβ exits the widget and returns theunknownUnsignedvalue (peep thecdk_objs.hheader file for that one). this also sets the widget dataexitTypetovESCAPE_HIT. dramatic exit, no explanation πCtrl-Rβ refreshes the screen. glow up β¨
ok but wait β if the cursor is not pointing to the field's value, a whole different set of key bindings kicks in. not me having two personalities fr fr π you can use the left/right arrows to move the cursor onto the field's value, then modify it by typing characters to replace the digits and the sign. periodt.
Left Arrowβ decrements the scale by the normal value.Right Arrowβ increments the scale by the normal value.
dβ decrements the scale by the normal value.Dβ increments the scale by the accelerated value.-β decrements the scale by the normal value.+β increments the scale by the normal value.0β sets the scale to the low value.
π SEE ALSO π
go read these next bestie, they're literally the friend group:
and that's a wrap on cdk_uslider(3) π this page is living in the Curses Development Kit era, dated 2025-01-14, and it ate, no crumbs. mwah π go forth and slide those unsigned values, you absolute legend π¦β¨
π¦ where this page comes from
- debian trixie: libcdk5-dev 5.0.20250116-1 Β· BSD-4-Clause
- ubuntu questing: libcdk5-dev 5.0.20250116-1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms