I want my callback to execute, but not the default callback (or, how to I stop GTK from doing the default action when doing X)?
Many times, you are customizing behaviour of a widget, or changing a policy in GTK, and the default action it does it not what you want. To get around this, we rely on a fundamental point in GTK: that GTK, as well as applications, mainly uses signals to get things done in the interface. The process to disable a default action is: • Find out what signal is being emitted and handled by the default handler. Many times you already know the signal since you may be hooking to it already, and observing the default action happen after yours. • call widget.emit_stop_by_name(“signal_name”) (to stop the signal emission in the current widget) • return True (to make sure that the signal won’t propagate into parent handlers that may be the actual culprits for the default action) An example of this usage was reported by Graham Ashton. He had customized a keypress handler for a window, but every time the user triggered the Alt-arrow combination he was handling, the focus moved around between the widge
Related Questions
- I want my callback to execute, but not the default callback (or, how to I stop GTK from doing the default action when doing X)?
- Does that competitive nature translate into doing stunts or action sequences in films like Piranha 3D?
- New question, "Why does glutTimerFunc() only execute my callback once?"