Tk_SetClassProcs(3tk)
π Tk_SetClassProcs β register widget specific procedures π
okay bestie, gather round, because this is a Tk Library Procedure and it's genuinely iconic. It's called Tk_SetClassProcs and it lives in the 3tk manual section. Let's get into it π«Ά
β¨ NAME β¨
Tk_SetClassProcs β register widget specific procedures
πΈ SYNOPSIS πΈ
#include <tk.h>
Tk_SetClassProcs(tkwin, procs, instanceData)
π ARGUMENTS π
Tk_Window tkwin(in) β the token for the window you wanna modify, no cap.const Tk_ClassProcs *procs(in) β a pointer to the data structure holding your widget specific procedures. > β οΈ okay listen, this one matters: the data structure thatprocspoints at must be static. Tk keeps a reference to it for as long as the window exists, so if you let it go out of scope it's giving π. Don't do that to yourself.void *instanceData(in) β an arbitrary one-word value that gets passed along to your widget callbacks. It's your little care package, iykyk.
π¦ DESCRIPTION π¦
Tk_SetClassProcs is what you call to register a set of procedures that get used as callbacks in different places. Very main character energy of it.
The structure that procs points to contains the following:
typedef struct {
Tcl_Size size;
Tk_ClassWorldChangedProc *worldChangedProc;
Tk_ClassCreateProc *createProc;
Tk_ClassModalProc *modalProc;
} Tk_ClassProcs;
The size field exists to make future expansion of the structure easy β it's the lowkey genius move. It should always be set to (literally) sizeof(Tk_ClassProcs).
π« worldChangedProc π«
worldChangedProc gets invoked when the system has altered in some way that requires some reaction from the widget. For example, when a font alias (peep the font manual entry) is reconfigured, widgets configured to use that font alias have to update their display accordingly. Slay, keep up π
worldChangedProc should have arguments and results that match the type Tk_ClassWorldChangedProc:
typedef void Tk_ClassWorldChangedProc(
void *instanceData);
The instanceData parameter passed to the worldChangedProc will be identical to the instanceData parameter passed to Tk_SetClassProcs. Same one, fr fr.
π createProc π
createProc is used to create platform-dependent windows. It gets invoked by Tk_MakeWindowExist. Obsessed with a handoff honestly.
createProc should have arguments and results that match the type Tk_ClassCreateProc:
typedef Window Tk_ClassCreateProc(
Tk_Window tkwin,
Window parent,
void *instanceData);
The tkwin and instanceData parameters will be identical to the tkwin and instanceData parameters passed to Tk_SetClassProcs. The parent parameter will be the parent of the window to be created. And the createProc should return the created window β that's its whole job, periodt.
β modalProc β
modalProc gets invoked after all bindings on a widget have been triggered, in order to handle a modal loop. It's the cleanup-bestie of the group.
modalProc should have arguments and results that match the type Tk_ClassModalProc:
typedef void Tk_ClassModalProc(
Tk_Window tkwin,
XEvent *eventPtr);
The tkwin parameter to modalProc will be identical to the tkwin parameter passed to Tk_SetClassProcs. The eventPtr parameter will be a pointer to an XEvent structure describing the event being processed. πΈ
π KEYWORDS π
callback, class
and that's the whole page, bestie β you ate it π
this was pulled straight from Tk 8.4, and the page itself is Tk_SetClassProcs(3tk). mwah, go forth and register your procs πβ¨π¦
π¦ 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) 2000 Ajuba Solutions
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms