Tk_Grab(3)
okay bestie, welcome to the Tk Library Procedures page for Tk_Grab(3) β aka the grab-state control manual, and yes itβs giving main character window energy π
β¨
π NAME π
Tk_Grab, Tk_Ungrab β manipulate grab state in an application
β¨ SYNOPSIS β¨
C signatures, verbatim, no edits, periodt π«Ά
#include <tk.h>
int
Tk_Grab(interp, tkwin, grabGlobal)
Tk_Ungrab(tkwin)
π ARGUMENTS π
Tcl_Interp *interp(in) β the interpreter used for error reporting.Tk_Window tkwin(in) β the window on whose behalf the pointer is to be grabbed or released.int grabGlobal(in) β a Boolean indicating whether the grab is global or application local.
π¦ DESCRIPTION π¦
These functions are how you set or release a global or application-local grab. When a grab is set on a particular window in a Tk application, mouse and keyboard events can only be received by that window and its descendants. Mouse and keyboard events for windows outside the tree rooted at tkwin get redirected to tkwin.
If the grab is global, then all mouse and keyboard events for windows outside the tree rooted at tkwin β even those intended for windows in other applications β will be redirected to tkwin.
If the grab is application local, only mouse and keyboard events intended for windows within the same application (but outside the tree rooted at tkwin) will be redirected.
Tk_Grab sets a grab on a particular window. tkwin specifies the window on whose behalf the pointer is to be grabbed β the page calls it Tkwin right there, capital-T moment, same window β¨. grabGlobal indicates whether the grab should be global or application local; if it is non-zero, it means the grab should be global.
Normally, Tk_Grab returns TCL_OK. If an error occurs and the grab cannot be set, TCL_ERROR is returned and an error message is left in interp's result β the source literally says βleft if interp's resultβ, which is giving typo energy π, but the meaning is error reporting via interp, no cap.
Once this call completes successfully, no window outside the tree rooted at tkwin will receive pointer- or keyboard-related events until the next call to Tk_Ungrab. If a previous grab was in effect within the application, then it is replaced with a new one.
π Big grab energy: outside-tree windows are on mute until Tk_Ungrab shows up.
Tk_Ungrab releases a grab on the mouse pointer and keyboard, if there is one set on the window given by tkwin. Once a grab is released, pointer and keyboard events will start being delivered to other windows again.
πΈ KEYWORDS πΈ
grab, window β thatβs the whole keyword set, periodt π
π source/version: Tk Β· page: Tk_Grab(3) Β· date: not listed on this page, so no invented date, bestie π
π¦ where this page comes from
- alpine 3.23: tk9-doc 9.0.3-r0 Β· TCL
- alpine 3.24: tk9-doc 9.0.3-r2 Β· TCL
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 43: tk-devel 1:9.0.2-1.fc43 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- fedora 44: tk-devel 1:9.0.2-1.fc44 Β· TCL AND HPND-Pbmplus AND CC-BY-SA-3.0 AND MIT-open-group AND MIT
- nixos 26.05: tk 9.0.3
- nixpkgs unstable: tk 9.1.0
- Copyright (c) 1998-2000 Scriptics Corporation
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms