Re: Tcl bug?
- From: Ken Tilton <kentilton@xxxxxxxxx>
- Date: Sun, 14 May 2006 23:26:12 -0400
Ken Tilton wrote:
here is a log my lisp application creates as it puts up a minimal Tk window:
proc TraceOP {n1 n2 op} {event generate $n1 <<tracewrite>> -data {$n1 $op}}
frame .f44 -class frame -pady 0 -padx 0
entry .f44.ent45 -textvariable .f44.ent45
set .f44.ent45 "Boots"
trace add variable .f44.ent45 write TraceOP
wm title . "One-Button-Window"
pack .f44.ent45 -side top -anchor nw -padx 0 -pady 0
pack .f44
wm deiconify .
bind . <Escape> {destroy .}
I trace the variable so the application can know of all editing. A handler traps all events and manages to get the faux virtual event <<tracewrite>>, at which point it tries to get the new value of the field by executing this:
set .f44.ent45
The result is:
Error: Tcl error: can't read ".f44.ent45": no such variable
Similar code worked Ok when I had a different way of faking callbacks.
This is: ActiveState ActiveTcl 8.5.0.0.261540 Beta 5
btw, turning the above into a text .tcl file works fine and after modifying the entry I am able to read the field via the set.
Also, I can add a button that does no more than print a debug line with a tcl_eval of "set .f44.ent45". Disabling the failing read, i can type in the entry and then see the new value in the log by pushing the button.
I thought the problem might be that the failed read is done as part of the processing (rather indirectly) of a write to the field. That oddity might trigger a bug. I still like the theory, but confess I had no luck replicating it interactively and adding a read operation to the trace write action.
Any ideas welcome.
[btw I do not see my followup article reporting the same in 8.4.12, but it should be along soon. anyway...]
Bug? Maybe, but who cares? I am using the C interface and I just noticed Tcl_TraceVar and Tcl_GetVar. Duhhhhh! :)
I will give those a go and forget about this problem mixing Tcl_Eval and true C API programming.
kenny
--
Cells: http://common-lisp.net/project/cells/
"Have you ever been in a relationship?"
Attorney for Mary Winkler, confessed killer of her
minister husband, when asked if the couple had
marital problems.
.
- Follow-Ups:
- Re: Tcl bug?
- From: Ken Tilton
- Re: Tcl bug?
- References:
- Tcl bug?
- From: Ken Tilton
- Tcl bug?
- Prev by Date: Tcl bug?
- Next by Date: bind question - is there a not modifier?
- Previous by thread: Tcl bug?
- Next by thread: Re: Tcl bug?
- Index(es):
Loading