Tk_HandleEvent(3)

πŸ’… Tk_HandleEvent(3) β€” Tk Library Procedures πŸ’…

🌸 NAME 🌸

Tk_HandleEvent β€” invoke event handlers for window system events.

✨ SYNOPSIS ✨

#include <tk.h>

Tk_HandleEvent(eventPtr)

πŸŽ€ ARGUMENTS πŸŽ€

  • XEvent *eventPtr (in) β€” pointer to the X event you're dispatching to the relevant handler(s). And bestie, it is important that all unused fields of the structure be set to zero. Like, zeroed-zeroed. No cap. πŸ™ˆ

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so Tk_HandleEvent is a lower-level procedure that deals with window events. It's called by Tcl_ServiceEvent (and indirectly by Tcl_DoOneEvent), plus in a few other cases within Tk. It makes callbacks to any window event handlers β€” the ones created by calls to Tk_CreateEventHandler β€” that match eventPtr, and then it returns. Periodt. πŸ’…

In some cases it may be useful for an application to bypass the Tk event queue and call Tk_HandleEvent directly instead of calling Tcl_QueueEvent followed by Tcl_ServiceEvent. It's giving "I'll take the shortcut, thank you" energy. ✨

This procedure may be invoked recursively. For example, it is possible to invoke Tk_HandleEvent recursively from a handler called by Tk_HandleEvent. This sort of operation is useful in some modal situations, such as when a notifier has been popped up and an application wishes to wait for the user to click a button in the notifier before doing anything else. Basically: pop-up is on screen, and we're all waiting for the click before anything else happens. Iconic modal behavior, honestly. πŸ‘‘

πŸ‘‘ KEYWORDS πŸ‘‘

callback, event, handler, window


Big source/version kiss: Tk Β· page: Tk_HandleEvent(3) πŸ’–βœ¨

πŸ“¦ where this page comes from