Tk_GetReliefFromObj(3)

πŸ“¦
version 9.0.3 Β· 4 versions
, in alpine 3.22, alpine 3.23, alpine 3.24, arch rolling, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’… Tk_GetReliefFromObj β€” a Tk Library Procedures moment

okay bestie so this is one of those Tk Library Procedures pages, and honestly? it's giving "glow-up for your borders." three whole functions that translate between strings and relief values. yes ma'am. πŸŽ€


✨ NAME ✨

Tk_GetReliefFromObj, Tk_GetRelief, Tk_NameOfRelief β€” translate between strings and relief values


✨ SYNOPSIS ✨

#include <tk.h>

int
Tk_GetReliefFromObj(interp, objPtr, reliefPtr)

int
Tk_GetRelief(interp, name, reliefPtr)

const char *
Tk_NameOfRelief(relief)

✨ ARGUMENTS ✨

  • Tcl_Interp *interp (in) β€” the interpreter we use for error reporting. she's the one who'll be holding the receipts if something goes wrong. πŸ™ˆ
  • Tcl_Obj *objPtr (in/out) β€” the string value in here contains the name of a relief, one of "flat", "groove", "raised", "ridge", "solid", or "sunken" (or, on input, any unique abbreviation thereof, slay). the internal rep gets modified to cache the corresponding relief value. she's taking notes for next time. ✨
  • const char *name (in) β€” literally the same as objPtr except the description of the relief comes through as a plain string instead of an object. same vibe, different packaging. 🫢
  • int *reliefPtr (out) β€” pointer to the spot where we're gonna store the relief value that corresponds to objPtr or name. drop it right there, queen. πŸ‘‘
  • int relief (in) β€” a relief value, which is one of TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE. pick your fighter. πŸ’…

✨ DESCRIPTION ✨

okay so Tk_GetReliefFromObj places into *reliefPtr the relief value that corresponds to the value of objPtr. and that value will be one of TK_RELIEF_FLAT, TK_RELIEF_RAISED, TK_RELIEF_SUNKEN, TK_RELIEF_GROOVE, TK_RELIEF_SOLID, or TK_RELIEF_RIDGE. no cap. πŸ¦‹

under normal circumstances the return value is TCL_OK and interp is unused β€” she's just sitting there, not needed, living her best life. but bestie, if objPtr does not contain one of the valid relief names or an abbreviation of one of them, then TCL_ERROR gets returned, *reliefPtr stays unmodified, and an error message gets stored in interp's result if interp is not NULL. and Tk_GetReliefFromObj caches information about the return value in objPtr, which speeds up future calls to Tk_GetReliefFromObj with the same objPtr. it's giving muscle memory. πŸ’–

Tk_GetRelief is identical to Tk_GetReliefFromObj except that the description of the relief is specified with a string instead of an object. but β€” and this is the tea β˜• β€” that means Tk_GetRelief cannot cache the return value, so Tk_GetRelief is less efficient than Tk_GetReliefFromObj. she's doing the same job with none of the shortcuts. respect, but also, like, inefficient bestie. 😭

Tk_NameOfRelief is the logical inverse of Tk_GetRelief. give her a relief value and she returns the corresponding string (flat, raised, sunken, groove, solid, or ridge). and if relief is not a legal relief value? then "unknown relief" is returned. she said "idk her." πŸ’€


✨ KEYWORDS ✨

name, relief, string


and that's the whole page, periodt. πŸŽ€ this was Tk 8.1, from the Tk_GetReliefFromObj(3) era β€” mwah, kisses, go make something pretty with your borders. πŸ’œβœ¨

πŸ“¦ where this page comes from