cdk_uscale(3)

🌸 cdk_uscale β€” the manual, bestie edition 🌸

part of the Cdk library calls β€” cdk_uscale(3), no cap πŸ’…


✨ NAME ✨

cdk_uscale β€” the Cdk scale widget (type unsigned) 🎚️✨


πŸ¦‹ SYNOPSIS πŸ¦‹

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

#include <cdk.h>

okay so here's the whole cast of characters, every single one, in order, fr fr:

unsigned activateCDKUScale (
               CDKUSCALE *scale,
               chtype *actions);

void destroyCDKUScale (
               CDKUSCALE *scale);

void drawCDKUScale (
               CDKUSCALE *scale,
               boolean box);

void eraseCDKUScale (
               CDKUSCALE *scale);

boolean getCDKUScaleBox (
               CDKUSCALE *scale);

unsigned getCDKUScaleHighValue (
               CDKUSCALE *scale);

unsigned getCDKUScaleLowValue (
               CDKUSCALE *scale);

unsigned getCDKUScaleValue (
               CDKUSCALE *scale);

int injectCDKUScale (
               CDKUSCALE *scale,
               chtype input);

void moveCDKUScale (
               CDKUSCALE *scale,
               int xpos,
               int ypos,
               boolean relative,
               boolean refresh);

CDKUSCALE *newCDKUScale (
               CDKSCREEN *cdkscreen,
               int xpos,
               int ypos,
               const char *title,
               const char *label,
               chtype fieldAttribute,
               int fieldWidth,
               unsigned currentValue,
               unsigned lowValue,
               unsigned highValue,
               unsigned increment,
               unsigned fastIncrement,
               boolean box,
               boolean shadow);

void positionCDKUScale (
               CDKUSCALE *scale);

void setCDKUScale (
               CDKUSCALE *scale,
               unsigned lowValue,
               unsigned highValue,
               unsigned currentValue,
               boolean box);

void setCDKUScaleBackgroundAttrib (
               CDKUSCALE *scale,
               chtype attribute);

void setCDKUScaleBackgroundColor (
               CDKUSCALE *scale,
               const char * color);

void setCDKUScaleBox (
               CDKUSCALE *scale,
               boolean box);

void setCDKUScaleBoxAttribute (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleHorizontalChar (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleLLChar (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleLRChar (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleLowHigh (
               CDKUSCALE *scale,
               unsigned low,
               unsigned high);

void setCDKUScalePostProcess (
               CDKUSCALE *scale,
               PROCESSFN callback,
               void * data);

void setCDKUScalePreProcess (
               CDKUSCALE *scale,
               PROCESSFN callback,
               void * data);

void setCDKUScaleULChar (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleURChar (
               CDKUSCALE *scale,
               chtype character);

void setCDKUScaleValue (
               CDKUSCALE *scale,
               unsigned value);

void setCDKUScaleVerticalChar (
               CDKUSCALE *scale,
               chtype character);

like… that's a LOT of functions and every single one of them is here, I did not skip a single one, bestie, I would never πŸ™ˆ


πŸ’– DESCRIPTION πŸ’–

The Cdk scale widget creates a scale box with a label and a scale field. πŸŽ€

It's giving "little slider, big feelings" β€” you get a box, a title situation, a label, and a value you can drag up and down. iconic behavior honestly. ⭐

The following functions create or manipulate the Cdk scale box widget. 🫢

heads up: this is part 1 of 3, so don't go anywhere β€” the option-by-option breakdown and all the juicy details are still coming πŸ’œ

✨ AVAILABLE FUNCTIONS ✨

okay bestie, here’s the whole function lineup for cdk_uscale. every single one. no skips. periodt. πŸ’…


activateCDKUScale 🌸

this one activates the scale widget and lets the user interact with it. it’s the β€œgo be interactive” button, basically.

  • the parameter scale is a pointer to a non-NULL scale 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 value from the low value to the high value. it will also set the widget data exitType to vNORMAL.
    • if the character entered into this widget was ESCAPE then the widget will return the unknownUnsigned value (see the cdk_objs.h header file).

the widget data exitType will be set to vESCAPE_HIT.


destroyCDKUScale πŸ’€

removes the widget from the screen and frees memory the object used. it’s the cleanup bestie. bye πŸ‘‹


drawCDKUScale 🎨

draws the scale widget on the screen.

if the box parameter is true, the widget is drawn with a box.


eraseCDKUScale 🧽

removes the widget from the screen. this does NOT destroy the widget. so like, it’s gone from view but still alive. ghosting, but make it software.


getCDKUScaleBox πŸ“¦

returns whether the widget will be drawn with a box around it.


getCDKUScaleHighValue ⬆️

returns the high value of the scale widget.


getCDKUScaleLowValue ⬇️

returns the low value of the scale widget.


getCDKUScaleValue πŸ“Š

returns the current value of the widget.


injectCDKUScale πŸ’‰

injects a single character into the widget.

  • the parameter scale is a pointer to a non-NULL scale 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 value ranging from the scale's low value to the scale'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.

moveCDKUScale 🚚

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.


newCDKUScale ✨

creates a pointer to a scale 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. 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 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 scale field.
  • fieldAttribute β€” is the attribute of the characters displayed 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 scale field when the widget is activated.
  • lowValue and highValue β€” 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.


positionCDKUScale πŸ•ΉοΈ

allows the user to move the widget around the screen via the cursor/keypad keys. see cdk_position (3) for key bindings.


setCDKUScale πŸ› οΈ

lets the programmer modify certain elements of an existing scale widget.

the parameter names correspond to the same parameter names listed in the newCDKUScale function.


setCDKUScaleBackgroundAttrib 🎨

sets the background attribute of the widget.

the parameter attribute is a curses attribute, e.g., A_BOLD.


setCDKUScaleBackgroundColor 🌈

sets the background color of the widget.

the parameter color is in the format of the Cdk format strings.

see cdk_display (3).


setCDKUScaleBox πŸ“¦

sets whether the widget will be drawn with a box around it.


setCDKUScaleBoxAttribute πŸ–ŒοΈ

sets the attribute of the box.


setCDKUScaleHorizontalChar βž–

sets the horizontal drawing character for the box to the given character.


setCDKUScaleLLChar ↙️

sets the lower left hand corner of the widget's box to the given character.


setCDKUScaleLRChar β†˜οΈ

sets the lower right hand corner of the widget's box to the given character.


setCDKUScaleLowHigh βš–οΈ

sets the low and high values of the widget.


setCDKUScalePostProcess 🧠

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).


setCDKUScalePreProcess 🧠

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).


setCDKUScaleULChar ↖️

sets the upper left hand corner of the widget's box to the given character.


setCDKUScaleURChar ↗️

sets the upper right hand corner of the widget's box to the given character.


setCDKUScaleValue πŸ’Ύ

sets the current value of the widget.


setCDKUScaleVerticalChar βž•

sets the vertical drawing character for the box to the given character.

✨ KEY BINDINGS ✨

okay so when the widget is activated, there's a whole bunch of default key bindings already set up to help you enter or manipulate the info super fast πŸ’–. here's the rundown of every key and what it does for this widget:

  • Down Arrow β€” Decrements the scale by the normal value.
  • Up Arrow β€” Increments the scale by the normal value.
  • u β€” Increments the scale by the normal value.
  • Prev Page β€” Decrements the scale by the accelerated value.
  • U β€” Decrements the scale by the accelerated value.
  • Ctrl-B β€” Decrements the scale by the accelerated value.
  • Next Page β€” Increments the scale by the accelerated value.
  • Ctrl-F β€” Increments the scale by the accelerated value.
  • Home β€” Sets the scale to the low value.
  • g β€” Sets the scale to the low value.
  • ^ β€” Sets the scale to the low value.
  • End β€” Sets the scale to the high value.
  • G β€” Sets the scale to the high value.
  • $ β€” Sets the scale to the high value.
  • Return β€” Exits the widget and returns the index of the selected value. This also sets the widget data exitType to vNORMAL.
  • Tab β€” Exits the widget and returns the index of the selected value. This also sets the widget data exitType to vNORMAL.
  • Escape β€” Exits the widget and returns the unknownUnsigned value (see the cdk_objs.h header file). This also sets the widget data exitType to vESCAPE_HIT.
  • Ctrl-R β€” Refreshes the screen.

so if the cursor is not pointing at the field's value, these other key bindings kick in instead πŸ¦‹. 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 πŸ’…

  • 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 πŸ‘€


and that's a wrap bestie, you ate this whole page fr fr πŸŽ€ this one's dated 2025-10-13 and it's living in section cdk_uscale(3) β€” go forth and scale those values, main character energy only πŸ’œβœ¨