![]() |
Available news archives:
comp.lang.tcl
-
comp.lang.python
-
comp.security.firewalls
-
sci.crypt -
comp.lang.php -
comp.lang.javascript
|
|
comp.lang.tcl archiveRe: Again: error in event handler while using BLT bgexec: global variable seems to vanish.
From: Keith Nash <kjn9@citizenearth.com>
Date: Mon Sep 12 2005 - 23:46:35 CEST
Robert,
This seems to be a bug in BLT. BLT's docs for bgexec specify that Tk events
The workaround is to run the bgexec command with 'uplevel #0'.
The attached script has the workaround, and also has 'info vars' (commented
Best wishes,
Keith.
package require BLT
global widgets
set widgets(listbox) .l
#listbox $widgets(listbox) -selectmode extended -yscrollcommand {puts "<[info vars]>"; puts "Level = [info level]"; $widgets(scrollbar) set}
set people [list Peter Paul Mary Caesar Herodes Nero Nena Nina Nonna]
pack $widgets(scrollbar) -side right -expand true -fill y
bind $widgets(listbox) <<ListboxSelect>> [list update_selection %W]
proc update_selection {W} {
foreach i [$W curselection] {
set dataset(selection) $selection
if {![info exists dataset(worker)]} {
return
proc update_worker {} {
uplevel #0 {blt::bgexec dataset(external) -onerror puts -onoutput puts $tclExe external.tcl [join $dataset(selection)]}
unset dataset(worker)
return
|