Sujet : Re: bind
De : wortkarg3 (at) *nospam* yahoo.com (Harald Oehlmann)
Groupes : comp.lang.tclDate : 07. Apr 2025, 18:15:55
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <vt118c$347u7$4@dont-email.me>
References : 1
User-Agent : Mozilla Thunderbird
Am 07.04.2025 um 18:51 schrieb Manfred Stelzhammer:
Hi
I have a small script.
#### script start
toplevel .top
pack [frame .top.f]
pack [entry .top.f.en]
bind .top <Button-1> "tuwas b1 %W"
bind .top <Down> "tuwas down %W"
proc tuwas {cmd W} {
puts "$cmd : $W"
if {$W ne ".top.f"} {
if {$cmd eq "b1"} {event generate .top.f <Button-1> }
if {$cmd eq "down"} {event generate .top.f <Down> }
}
}
#### script end
If I press the mouse-button on .top.f.en I get two outputs:
b1 : .top.f.en
b1 : .top.f
That's was I expected.
If I on .top.f.en and I press <Down> I get many (501) outputs:
down : .top.f.en
down : .top.f.en
down : .top.f.en
I get an error: "error: too many nested evaluations (infinite loop?)"
I expected I get:
down : .top.f.en
down : .top.f
If I press <Down> on .top.f the proc tuwas should generate a event on .top.f not on .top.f.en
Why this different behavior?
What do I wrong?
reagards
Manfred
Consider to use "break" as last command of your binding script.
This avoids to call any following binding scripts.
Harald