[Explain virtual events. Is there a tutorial? Illustrate usage. Put forward references in appropriate places--what are those? "advanced Tk-ing?"]
[Important thread: http://groups.google.com/groups?th=5f799aadcb2caf35 ]
Bryan Oakley's wizard mega- (meta?) widget taught me a wonderful use of virtual events. Whereas I had code in my wizard implementation like:
proc doNextThing { args } { ... } button $w.next -text "Next" -command doNextThing
Bryan had the foresight to indirect the button handling via virtual events. Now I do something like:
proc doNextThing { args } { } proc dispatch { event } { switch -- $event { <<Next>> { doNextThing } ... } } ... button $w.next -text "Next" \ -command [list event generate $w <<Next>>] bind $w <<Next>> [list dispatch <<Next>>]
The wonder of this is that my testing harness can do:
bind $w <<Next>> {+doTestingThing}
and trap the button presses without making invasive changes to the wizard code!