Tk_GetScrollInfo(3tk)
π 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 manyTcl_Obj's are chillin in theobjvarray β¨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 typicallyxvieworyview. periodt.int argc(in) β how many strings are in theargvarray πΈconst char ** argv(in) β the argument strings. same vibe asobjv: they represent the entire widget command, first word usually the widget name, second word usuallyxvieworyviewπ¦double *fractionPtr(out) β gets filled in with the fraction from themovetooption, if there is one πint *stepsPtr(out) β gets filled in with the line or page count from thescrolloption, 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
objvhas themovetoform βTK_SCROLL_MOVETOis returned as the result, and*fractionPtrgets filled in with thefractionargument to the command, which must be a proper real value β - if
objvhas thescrollform βTK_SCROLL_PAGESorTK_SCROLL_UNITSis returned, and*stepsPtrgets filled in with thenumbervalue, 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_ERRORis returned, and an error message gets left in interpreterinterp'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
- debian trixie: tk9.0-doc 9.0.1-3
- ubuntu questing: tk9.0-doc 9.0.2-1
- ubuntu resolute: tk9.0-doc 9.0.3-1
- ubuntu stonking: tk9.0-doc 9.0.4-1
- Copyright (c) 1994 The Regents of the University of California
- Copyright (c) 1994-1996 Sun Microsystems, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms