---
name: "SetClassProcs"
section: "3"
platform: "macos"
package: "tcl"
version: "152"
release: "macOS 26.5"
platforms: ["macos"]
url: "https://new.carta.tech/SetClassProcs"
---

# SetClassProcs(3)

register widget specific procedures

## NAME

Tk\_SetClassProcs - register widget specific procedures

## SYNOPSIS

```
#include <tk.h>

Tk_SetClassProcs(tkwin, procs, instanceData)
```

## ARGUMENTS

Token for window to modify. Pointer to data structure containing widget specific procedures. The data structure pointed to by *procs* must be static: Tk keeps a reference to it as long as the window exists. Arbitrary one-word value to pass to widget callbacks.

## DESCRIPTION

**Tk\_SetClassProcs** is called to register a set of procedures that are used as callbacks in different places.

The structure pointed to by *procs* contains the following: typedef struct Tk\_ClassProcs {\
     unsigned int *size*;\
     Tk\_ClassWorldChangedProc \**worldChangedProc*;\
     Tk\_ClassCreateProc \**createProc*;\
     Tk\_ClassModalProc \**modalProc*; } Tk\_ClassProcs; The *size* field is used to simplify future expansion of the structure. It should always be set to (literally) **sizeof(Tk\_ClassProcs)**.

*worldChangedProc* is invoked when the system has altered in some way that requires some reaction from the widget.  For example, when a font alias (see the **font** manual entry) is reconfigured, widgets configured to use that font alias must update their display accordingly.  *worldChangedProc* should have arguments and results that match the type **Tk\_ClassWorldChangedProc**: typedef void Tk\_ClassWorldChangedProc(\
     ClientData *instanceData*); The *instanceData* parameter passed to the *worldChangedProc* will be identical to the *instanceData* parameter passed to **Tk\_SetClassProcs**.

*createProc* is used to create platform-dependant windows.  It is invoked by **Tk\_MakeWindowExist**.  *createProc* should have arguments and results that match the type **Tk\_ClassCreateProc**: typedef Window Tk\_ClassCreateProc(\
     Tk\_Window *tkwin*,\
     Window *parent*,\
     ClientData *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.  The *createProc* should return the created window.

*modalProc* is invoked after all bindings on a widget have been triggered in order to handle a modal loop.  *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
