Tk_GeometryRequest(3tk)

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

πŸ’– Tk_GeometryRequest β€” the "hey bestie can I be this big pls" manual page πŸ’–

okay so this is a page from the Tk Library Procedures collection, and it's literally all about telling Tk how big you want your window to be, and how much internal border space to leave around the edges. no cap. πŸŽ€


✨ NAME ✨

Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder, Tk_SetInternalBorderEx β€” specify desired geometry or internal border for a window πŸ¦‹


🌸 SYNOPSIS 🌸

#include <tk.h>

Tk_GeometryRequest(tkwin, reqWidth, reqHeight)

Tk_SetMinimumRequestSize(tkwin, minWidth, minHeight)

Tk_SetInternalBorder(tkwin, width)

Tk_SetInternalBorderEx(tkwin, left, right, top, bottom)

🫢 ARGUMENTS 🫢

  • Tk_Window tkwin (in) β€” the window we're out here requesting geometry for, bestie. πŸ‘‘
  • int reqWidth (in) β€” the width you want for tkwin, measured in pixel units. ✨
  • int reqHeight (in) β€” the height you want for tkwin, in pixel units. πŸ’…
  • int minWidth (in) β€” the minimum requested width you desire for tkwin, in pixel units.
  • int minHeight (in) β€” the minimum requested height you desire for tkwin, in pixel units.
  • int width (in) β€” how much space to leave for the internal border of tkwin, in pixel units. πŸŽ€
  • int left (in) β€” space to leave for the left side of the internal border for tkwin, in pixel units.
  • int right (in) β€” space to leave for the right side of the internal border for tkwin, in pixel units.
  • int top (in) β€” space to leave for the top side of the internal border for tkwin, in pixel units.
  • int bottom (in) β€” space to leave for the bottom side of the internal border for tkwin, in pixel units.

πŸ’… DESCRIPTION πŸ’…

Tk_GeometryRequest is the one widget code calls when it wants to be like "hi yes I would love these dimensions for this specific window, thank u". πŸ“ The arguments you hand to Tk_GeometryRequest get passed along to the geometry manager for that window, and then the geometry manager decides what the actual geometry is gonna be. so it's giving "I have opinions" not "I make the rules".

and here's the thing: even though geometry managers generally do try to satisfy the requests you make to Tk_GeometryRequest, there is no guarantee it'll always be possible. 😭 like, they'll try their best, but bestie, no promises.

so widget code should not assume a geometry request was satisfied until it gets a ConfigureNotify event saying the geometry change actually happened. that's the receipt. no receipt, no assumption. 🧾

also, widget code should never call procedures like Tk_ResizeWindow directly. πŸ™ˆ instead, invoke Tk_GeometryRequest and let the geometry manager make the final geometry decisions. stay in your lane, let the manager cook. πŸ‘‘

if tkwin is a top-level window, then the geometry information gets passed to the window manager using the standard ICCCM protocol. fancy. iconic. ✨


Tk_SetInternalBorder is what widget code calls to say "hey, I have an internal border." πŸŽ€ this means the widget draws a decorative border inside the window, instead of using the standard X borders, which are external to the window's area. for example, internal borders are used to draw 3-D effects. 😌 width specifies the width of the border in pixels. geometry managers will use this info to avoid placing any children of tkwin overlapping the outermost width pixels of tkwin's area. so like, personal space, respected. 🫢

Tk_SetInternalBorderEx works like Tk_SetInternalBorder but lets you specify different widths for different sides of the window. so you can be asymmetric about it. main character energy. 🌈


Tk_SetMinimumRequestSize is what widget code calls to tell a geometry manager "you should request at least this size for the widget." πŸ“ this lets a widget have some control over its size when a propagating geometry manager is used inside it. slay. ✨


the info you specified in calls to Tk_GeometryRequest, Tk_SetMinimumRequestSize, Tk_SetInternalBorder and Tk_SetInternalBorderEx can be retrieved using the macros Tk_ReqWidth, Tk_ReqHeight, Tk_MinReqWidth, Tk_MinReqHeight, Tk_MinReqWidth, Tk_InternalBorderLeft, Tk_InternalBorderRight, Tk_InternalBorderTop and Tk_InternalBorderBottom. πŸ‘€ see the Tk_WindowId manual entry for details, iykyk.


⭐ KEYWORDS ⭐

geometry, request


okay that's the whole page, bestie, you ate it up fr fr πŸ’– huge thanks to Tk, version 8.4, for blessing us with this documentation, and shoutout to the Tk_GeometryRequest(3tk) page itself for keeping it real. mwah. 😘🌸

πŸ“¦ where this page comes from