Sujet : Re: An XOTcl question
De : stefan.sobernig (at) *nospam* wu.ac.at (Stefan Sobernig)
Groupes : comp.lang.tclDate : 10. Jul 2024, 23:36:28
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <94712dd1-0594-4ca4-9830-5af3a3cdb12a@wu.ac.at>
References : 1
User-Agent : Mozilla Thunderbird
Hi Helmut!
Any help or idea will be greatly appreciated.
I tried to reproduce the erroneous behaviour using XOTcl 2.3 and Tcl 8.6.13 on macOS, but I failed, I am afraid.
Could you create a minimal, reproducible script?
What I tried:
---------------%<---------------
puts [package req Tcl]
puts [package req XOTcl]
## setup
xotcl::Class Base -parameter {parent} \
-instproc init {canvas coordinates {mainDict ""}} {;}
xotcl::Class Line -parameter {{id 321}} -superclass Base
xotcl::Class Point -superclass Base -instproc init {args} {
puts $args
}
xotcl::Class LinePoint -superclass Point
proc ::bindC {args} {;}
## distilled
LinePoint instproc init {canvas {coords ""}} { next }
# ctor - coords are <x, y, starting widget>
Line instproc init {canvas coordLst {cName ""}} {
my instvar c cfg coords id
set c .cc
# call base class ctor
lassign $coordLst x y widgets
set tgt [self next]; puts "$tgt === [[lindex $tgt 0] info instargs [lindex $tgt 2]]"
next $canvas [list $x $y] ;#$cfg ;#$options
set coords {} ; set widgets {}
puts lb
# create first point
my newLinePoint $x $y
puts lc
bindC $c $id <Enter> {s::mkLargePointCurs $c}
}
# Create a new point
Line instproc newLinePoint {x y} {
my instvar c children coords
# set x [$c canvasx $x] ; set y [$c canvasy $y]
lappend children [LinePoint [LinePoint autoname Point%d] $c [list $x $y] -parent [self]]
lappend coords $x $y
}
## main.tcl ?
::Line Line1 .mainFr.c {72 66 ::LEDBtn1} -parent ::C
---------------%<---------------
This produces:
---------------%<---------------
8.6.13
2.3
::Base instproc init === canvas coordinates mainDict
lb
.cc {72 66}
lc
---------------%<---------------
Could you add the following introspection line just before [next] is called in your actual script?
---------------%<---------------
set tgt [self next]; puts "$tgt === [[lindex $tgt 0] info instargs [lindex $tgt 2]]"
---------------%<---------------
Best, Stefan