Tk_GetScrollInfo(3)

πŸ’… Tk_GetScrollInfo(3) β€” Tk Library Procedures πŸŽ€

okay so bestie, welcome to the Tk Library Procedures page for Tk_GetScrollInfoObj and Tk_GetScrollInfo β€” genuinely iconic little helpers, no cap.


✨ NAME ✨

Tk_GetScrollInfoObj, Tk_GetScrollInfo β€” literally the functions that parse arguments for scrolling commands. that's it, that's the gig 🫢


🌸 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 for error reporting. if something goes wrong, the tea gets spilled here πŸ’€
  • Tcl_Size objc (in) β€” how many Tcl_Obj's live in the objv array.
  • Tcl_Obj *const *objv (in) β€” the argument objects. these represent the entire widget command, where the first word is typically the widget name and the second word is typically xview or yview. main character energy fr fr πŸ‘‘
  • int argc (in) β€” how many strings are in the argv array.
  • const char **argv (in) β€” the argument strings. again, these represent the entire widget command: first word is typically the widget name, second word is typically 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 entire list of words that make up a widget command, and it parses the words starting with objv[2]. those words starting with objv[2] must have one of these forms:

moveto fraction
scroll number pages
scroll number units

any of the moveto, scroll, pages, and units keywords may be abbreviated (yes bestie, abbreviations are valid, slay) ✨

if objv has the moveto form, then TK_SCROLL_MOVETO is returned as the result, and *fractionPtr gets filled in with the fraction argument to the command β€” and that fraction must be a proper real value.

if objv has the scroll form, then TK_SCROLL_PAGES or TK_SCROLL_UNITS is returned, and *stepsPtr gets filled in with the number value. that number must be an integer or a float β€” but if it is a float, 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 is left in interpreter interp's result. so like, if it flops, it flops loudly πŸ’€

Tk_GetScrollInfo is identical in function to Tk_GetScrollInfoObj. the one glow-up: Tk_GetScrollInfo accepts string arguments, which makes it more appropriate for use with legacy widgets 🧚

ngl, the "identical in function" thing is real β€” same behaviour, just a string-flavoured interface for the legacy girlies.

πŸ”₯ KEYWORDS πŸ”₯

parse, scrollbar, scrolling command, xview, yview


that's the whole page, bestie β€” go parse some scroll commands, you're gonna ate πŸ’…

✧ο½₯゚ Tk 8.0 Β· Tk_GetScrollInfo(3) Β· sending you love and correct return values ο½₯゚✧ πŸ“

πŸ“¦ where this page comes from