Tk_SetGrid(3tk)
π Tk_SetGrid β bestie, let's talk grid control π
okay so this is the Tk Library Procedures page for Tk_SetGrid and Tk_UnsetGrid, and it's literally all about controlling the grid for interactive resizing. no cap. β¨
πΈ SYNOPSIS πΈ
#include <tk.h>
Tk_SetGrid(tkwin, reqWidth, reqHeight, widthInc, heightInc)
Tk_UnsetGrid(tkwin)
π ARGUMENTS π
Tk_Window tkwin(in) β bestie, this is just the token for the window. your lil window ID. that's it. π«Άint reqWidth(in) β the width in grid units that matches up with the pixel dimensiontkwinrequested viaTk_GeometryRequest. like, "how many grid units wide do you think you are, babe."int reqHeight(in) β same energy asreqWidthbut vertical: the height in grid units corresponding to the pixel dimensiontkwinrequested viaTk_GeometryRequest. πint widthInc(in) β width of ONE grid unit, in pixels. the smallest step. the atom of the grid. πint heightInc(in) β height of one grid unit, in pixels. vertical atom. iconic.
β¨ DESCRIPTION β¨
so Tk_SetGrid turns on gridded geometry management for tkwin's toplevel window and tells it exactly how the grid is shaped. π
Tk_SetGrid is typically invoked by a widget when its setGrid option is true. (yes, the widget is the one calling, it's giving main character energy.)
what it does: it restricts interactive resizing of tkwin's toplevel window so that the space allocated to the toplevel is equal to its requested size, plus or minus even multiples of widthInc and heightInc. so you can only snap in even grid steps, no chaotic in-between sizes, periodt. π
and ALSO β the reqWidth and reqHeight values get passed to the window manager so it can report the window's size in grid units during interactive resizes. the WM knows the grid now. it's informed. it's in the group chat. π¦
heads up bestie: iftkwin's configuration changes (e.g. the size of a grid unit changes), then the widget should invokeTk_SetGridagain with the new information. don't just sit there with stale numbers, that's not the vibe. π
Tk_UnsetGrid cancels gridded geometry management for tkwin's toplevel window. goodbye grid, we hardly knew ye. π
the big rule: for each toplevel window there can be at most one internal window with gridding enabled. so if Tk_SetGrid or Tk_UnsetGrid is invoked when some other window is already controlling gridding for tkwin's toplevel, the calls for the new window have no effect. π yeah. nothing happens. the OG keeps the crown. π
for extra lore on gridded geometry management, go see the wm manual entry. iykyk. π
β KEYWORDS β
grid, window, window manager
that's the whole page, bestie β no crumbs left behind π
this lil masterpiece comes to you from Tk, version 4.0, dated Tk_SetGrid(3tk) β mwah, slay, go resize something beautifully πβ¨π
π¦ 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) 1990-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