Tk_GetScrollInfo(3tk)

πŸ“¦
version 9.0.4 Β· 2 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

πŸ’– Tk_GetScrollInfo β€” bestie edition πŸ’–

okay so this is the Tk library procedure page for Tk_GetScrollInfoObj and Tk_GetScrollInfo, aka the little gremlins that parse arguments for scrolling commands. yes we are in the Tk manual, section 3tk, and no this is not scary, i promise, come sit with me 🫢


✨ NAME ✨

Tk_GetScrollInfoObj, Tk_GetScrollInfo β€” parse arguments for scrolling commands πŸ’…


🌸 SYNOPSIS 🌸

#include <tk.h>

int
Tk_GetScrollInfoObj(interp, objc, objv, fractionPtr, stepsPtr)

int
Tk_GetScrollInfo(interp, argc, argv, fractionPtr, stepsPtr)

πŸŽ€ ARGUMENTS πŸŽ€

  • Tcl_Interp *interp (in) β€” the interpreter we use to report errors, bestie. if something goes wrong, this is where the drama gets written down 😭
  • Tcl_Size objc (in) β€” how many Tcl_Obj's are chillin in the objv array ✨
  • Tcl_Obj *const * objv (in) β€” the argument objects. these represent the entire widget command, and like, typically the first word is the widget name and the second word is typically xview or yview. periodt.
  • int argc (in) β€” how many strings are in the argv array 🌸
  • const char ** argv (in) β€” the argument strings. same vibe as objv: they represent the entire widget command, first word usually the widget name, second word usually xview or yview πŸ¦‹
  • double *fractionPtr (out) β€” gets filled in with the fraction from the moveto option, if there is one πŸ’–
  • int *stepsPtr (out) β€” gets filled in with the line or page count from the scroll option, if there is one. heads up: the value may be negative πŸ‘€

🌈 DESCRIPTION 🌈

Tk_GetScrollInfoObj parses the arguments that widget scrolling commands like xview and yview expect. it receives the whole entire list of words that make up a widget command, and then it parses the words starting with objv[2] β€” yes, it just skips right past the first two, main character behaviour honestly πŸ‘‘

the words starting with objv[2] must have one of these forms, no exceptions:

moveto fraction
scroll number pages
scroll number units

any of the moveto, scroll, pages, and units keywords may be abbreviated. slay, shorthand rights πŸŽ€

so here's the tea on what gets returned:

  • if objv has the moveto form β†’ TK_SCROLL_MOVETO is returned as the result, and *fractionPtr gets filled in with the fraction argument to the command, which must be a proper real value ⭐
  • if objv has the scroll form β†’ TK_SCROLL_PAGES or TK_SCROLL_UNITS is returned, and *stepsPtr gets filled in with the number value, which must be an integer or a float. but bestie, listen: if it is a float, then it gets converted to an integer, rounded away from 0 πŸ’…
  • if an error happens while parsing the arguments β†’ TK_SCROLL_ERROR is returned, and an error message gets left in interpreter interp's result 😭

Tk_GetScrollInfo is identical in function to Tk_GetScrollInfoObj. literally the same girl, different fit. the one difference: Tk_GetScrollInfo accepts string arguments, which makes it more appropriate for use with legacy widgets 🧚

not me giving you the old-school version too because some widgets are still out here living their vintage era πŸ™ˆ

πŸ‘‘ KEYWORDS πŸ‘‘

parse, scrollbar, scrolling command, xview, yview


k bye ily, go parse some scroll arguments πŸ¦‹βœ¨

this was brought to you by Tk, version 8.0 β€” mwah πŸ’‹ πŸ“

πŸ“¦ where this page comes from