cdk_fslider(3)
β¨ cdk_fslider β¨
okay bestie, welcome to the cdk_fslider page β it's a library call from the Cdk fam π
. Grab a strawberry π, we're doing this.
πΈ NAME πΈ
cdk_fslider β the Cdk slider widget, but make it float π₯
like, it's the same slider energy you know and love, except the numbers it slides through are floats, not ints. it's giving precision, it's giving decimals, it's giving math π§
π SYNOPSIS π
first things first, you gotta link against the library, obviously:
cc [ flag ... ] file ... -lcdk [ library ... ]
and include the header, no cap:
#include <cdk.h>
and here's every single function this widget brings to the party, verbatim, character for character, because we do not abbreviate in this house π
int activateCDKFSlider (
CDKFSLIDER *slider,
chtype *actions);
void destroyCDKFSlider (
CDKFSLIDER *slider);
void drawCDKFSlider (
CDKFSLIDER *slider,
boolean box);
void eraseCDKFSlider (
CDKFSLIDER *slider);
boolean getCDKFSliderBox (
CDKFSLIDER *slider);
int getCDKFSliderDigits (
CDKFSLIDER *scale);
float getCDKFSliderHighValue (
CDKFSLIDER *slider);
float getCDKFSliderLowValue (
CDKFSLIDER *slider);
float getCDKFSliderValue (
CDKFSLIDER *slider);
float injectCDKFSlider (
CDKFSLIDER *slider,
chtype input);
void moveCDKFSlider (
CDKFSLIDER *slider,
int xpos,
int ypos,
boolean relative,
boolean refresh);
CDKFSLIDER *newCDKFSlider (
CDKSCREEN *cdkscreen,
int xpos,
int ypos,
const char *title,
const char *label,
chtype fillerCharacter,
int fieldWidth,
int currentValue,
float lowValue,
float highValue,
float increment,
float fastIncrement,
int digits,
boolean box,
boolean shadow);
void positionCDKFSlider (
CDKFSLIDER *slider);
void setCDKFSlider (
CDKFSLIDER *slider,
float lowValue,
float highValue,
float currentValue,
boolean box);
void setCDKFSliderBackgroundAttrib (
CDKFSLIDER *slider,
chtype attribute);
void setCDKFSliderBackgroundColor (
CDKFSLIDER *slider,
const char * color);
void setCDKFSliderBox (
CDKFSLIDER *slider,
boolean boxWidget);
void setCDKFSliderBoxAttribute (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderDigits (
CDKFSLIDER *scale,
int digits);
void setCDKFSliderHorizontalChar (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderLLChar (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderLRChar (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderLowHigh (
CDKFSLIDER *slider,
float lowValue,
float highValue);
void setCDKFSliderPostProcess (
CDKFSLIDER *slider,
PROCESSFN callback,
void * data);
void setCDKFSliderPreProcess (
CDKFSLIDER *slider,
PROCESSFN callback,
void * data);
void setCDKFSliderULChar (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderURChar (
CDKFSLIDER *slider,
chtype character);
void setCDKFSliderValue (
CDKFSLIDER *slider,
float value);
void setCDKFSliderVerticalChar (
CDKFSLIDER *slider,
chtype character);
π DESCRIPTION π
so here's the tea β β the Cdk slider widget spins up a visual slider box with a label and a slider field. think of it like the little draggy bar that goes from lowkey to highkey, except it's rendered in your terminal and it has β¨main character energyβ¨.
it creates a slider box with a label and a slider field, and then all the functions listed above are the ones that either create it or manipulate it.
ngl, that's the whole description here β the deets on each function are coming up in the parts that follow, so don't go anywhere bestie π«Ά
β¨ AVAILABLE FUNCTIONS β¨
okay bestie, this is the whole menu of stuff you can do with a Cdk FSlider widget. every function name is literally its own little vibe. no cap. π
activateCDKFSlider π
activates the slider widget and lets the user actually interact with it. main character energy fr.
- The parameter
slideris a pointer to a non-NULLslider widget. noNULLshenanigans allowed. - If the
actionsparameter is passed with a non-NULLvalue, the characters in the array will be injected into the widget.
To activate the widget interactively, pass in a NULL pointer for actions. iykyk.
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 unknownFloat value (see the cdk_objs.h header file). The widget data exitType is set to vESCAPE_HIT. dramatic exit, honestly.
destroyCDKFSlider π
removes the widget from the screen and frees memory the object used. it's giving cleanup era.
drawCDKFSlider π
draws the slider widget on the screen. If the box option is true, the widget is drawn with a box. iconic.
eraseCDKFSlider π§Ό
removes the widget from the screen. This does NOT destroy the widget. so don't ghost it and assume it's gone forever. periodt.
getCDKFSliderBox π¦
returns true if the widget will be drawn with a box around it.
getCDKFSliderDigits π’
returns the number of digits shown after the decimal point for the box value.
getCDKFSliderHighValue β¬οΈ
returns the high value of the slider widget.
getCDKFSliderLowValue β¬οΈ
returns the low value of the slider widget.
getCDKFSliderValue π
returns the current value of the widget.
injectCDKFSlider π
injects a single character into the widget. little keyboard chaos, but make it controlled.
- The parameter
slideris a pointer to a non-NULLslider 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:
RETURNorTABβ the function returns a value ranging from the slider's low value to the slider's high value. The widget dataexitTypeis set tovNORMAL.ESCAPEβ the function returns theunknownFloatvalue (see thecdk_objs.hheader file). The widget dataexitTypeis set tovESCAPE_HIT.
Otherwise, unless modified by preprocessing, postprocessing or key bindings, the function returns the unknownFloat value (see the cdk_objs.h header file). The widget data exitType is set to vEARLY_EXIT. okay so it can bounce early, noted.
moveCDKFSlider πΊ
moves the given widget to the given position. relocation era.
- The parameters
xposandyposare 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
relativestates whether thexpos/ypospair 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 valuesTOP,BOTTOM,LEFT,RIGHT, orCENTERwhenrelative = TRUE. (weird things may happen). bestie, I am begging you.
- The final parameter
refreshis a boolean value which states whether the widget will get refreshed after the move.
newCDKFSlider β¨
function creates a slider widget and returns a pointer to it.. 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 valuefastIncrementβ is the accelerated increment value.boxβ istrueif 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 girl hours.
positionCDKFSlider π±οΈ
allows the user to move the widget around the screen via the cursor/keypad keys. See cdk_position (3) for key bindings.
setCDKFSlider π§
lets the programmer modify certain elements of an existing slider widget. The parameter names correspond to the same parameter names listed in the newCDKFSlider function. so you already know the drill. iykyk.
setCDKFSliderBackgroundAttrib π¨
sets the background attribute of the widget.
The parameter attribute is a curses attribute, e.g., A_BOLD.
setCDKFSliderBackgroundColor π
sets the background color of the widget.
The parameter color is in the format of the Cdk format strings.
See cdk_display (3).
setCDKFSliderBox π
sets whether the widget will be drawn with a box around it.
setCDKFSliderBoxAttribute ποΈ
function sets the attribute of the box.
setCDKFSliderDigits π’
sets the number of digits shown after the decimal point for the box value.
setCDKFSliderHorizontalChar β
sets the horizontal drawing character for the box to the given character.
setCDKFSliderLLChar βοΈ
sets the lower left hand corner of the widget's box to the given character.
setCDKFSliderLRChar βοΈ
sets the lower right hand corner of the widget's box to the given character.
setCDKFSliderLowHigh βοΈ
sets the low and high values of the widget.
setCDKFSliderPostProcess π
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).
setCDKFSliderPreProcess βͺ
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).
setCDKFSliderULChar βοΈ
sets the upper left hand corner of the widget's box to the given character.
setCDKFSliderURChar βοΈ
sets the upper right hand corner of the widget's box to the given character.
setCDKFSliderValue π―
sets the current value of the widget.
setCDKFSliderVerticalChar β
sets the vertical drawing character for the box to the given character.
β¨ KEY BINDINGS β¨
okay so once you've activated the widget, there's a whole lil' set of default key bindings just vibing there waiting to help you type in or mess with the info super fast. here's the rundown of every key and what it does for this widget π
Down Arrowβ decrements the field by the normal decrement value.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.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.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.Tabβ exits the widget and returns the current value. this also sets the widget dataexitTypetovNORMAL.Escapeβ exits the widget and returns theunknownFloatvalue (peep thecdk_objs.hheader file for that one π). this also sets the widget dataexitTypetovESCAPE_HIT.Ctrl-Rβ refreshes the screen.
now, if the cursor is not pointing at the field's value, a whole different set of bindings kicks in. you can use the left/right arrows to move the cursor onto the field's value and then modify it by typing characters to replace the digits and the sign. it's giving β¨editor modeβ¨
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.
heads up bestie: notice how D does two completely different things depending on where your cursor is at. up top it's the accelerated increment, down here it's the accelerated increment on the scale. read the room (and the cursor position) before you press it π
π SEE ALSO π
and that's a wrap on the whole page, bestie π
this one's straight from the source, version cdk_fslider(3), dated 2025-10-13 β go forth and slide those floats, you absolute icon ππ¦
π¦ where this page comes from
- 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 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