Copyright © 2008, 2009 Arndt Roger Schneider
Best practice: bind the synthetic events generation for <<Activate>> and <<Deactivate>> onto <FocusIn>, <FocusOut>.
Example 6.36. FocusIn
bind »MyToplevelClass« <FocusIn> { foreach c [traverseActive %W] { event generate $c <<Activate>> } }
Example 6.37. FocusOut
bind »MyToplevelClass« <FocusOut> { foreach c [traverseActive %W] { event generate $c <<Deactivate>> } }
The Example 6.36, “FocusIn” and Example 6.37, “FocusOut” should be bound to the window class and not the individual window.
The above code is bundled into a separate package: »traverso«. Use the »register« procedure to activate it for your applications.