Re: Tcl bug?
- From: Ken Tilton <kentilton@xxxxxxxxx>
- Date: Mon, 15 May 2006 18:40:02 -0400
Donald Arseneau wrote:
Ken Tilton <kentilton@xxxxxxxxx> writes:
Donald Arseneau wrote:
Ken Tilton <kentilton@xxxxxxxxx> writes:
proc TraceOP {n1 n2 op} {event generate $n1 <<tracewrite>> -data {$n1 $op}}
Don't use braces for -data! You are preventing $n1 $op from
being substituted in the context of TraceOP.
Really? I thought I saw that working. maybe not since the last upheaval.
No, it is not a recent change.
Sorry, i meant upheaval in my code. :)
Variables in braces are not substituted
(immediately). You pass the literal string `$n1 $op' as the event data,
but the event is handled in the global scope after TraceOP returns, at
which time those variables have vanished.
You don't show the event handler code, so one can't say how you get from
that error to the specific error message.
Did it work with "-data [list $n1 $op]"?
Tcl_Eval("set .f44.ent55")
Are you sure it did that? It probably did "set $n1"
No, I pass the tkwin pointer associated with a widget as the client-data when registering the handler, and keep a hash table of tkwin (and xwin!) pointers back to the Lisp instance. And I did get an error dialogue popping up saying ".f44.ent55" was no good. (I guess this is another advantage of having the Tcl interpreter running in the same process.)
I guess since the trace command had triggered the callback, a procedure was
running and so the scope was local. Game over. :)
No, event handlers run at global (outermost) level. But maybe your handler
goes into its own scope (as it should).
Well, hang on, I will try without specifying global on the tcl_getvar....ok, looks like you are right. I can specify global_only or namespace_only and get the value. Strangely, specifying neither returns nothing but does not return an error. Oh, well. :)
thx for clarifying the scoping thing.
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.
.
- References:
- Tcl bug?
- From: Ken Tilton
- Re: Tcl bug?
- From: Donald Arseneau
- Re: Tcl bug?
- From: Ken Tilton
- Re: Tcl bug?
- From: Donald Arseneau
- Tcl bug?
- Prev by Date: Re: File selection crashes wish
- Next by Date: Re: tclxml package loading problems
- Previous by thread: Re: Tcl bug?
- Next by thread: bind question - is there a not modifier?
- Index(es):
Relevant Pages
|