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.
Thanks
I changed the script:
##
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 <KeyPress-Down>
break
}
}
}
##
But it doesn't change anything.
reagards
Manfred
Am 07.04.25 um 19:15 schrieb Harald Oehlmann:
Consider to use "break" as last command of your binding script.
This avoids to call any following binding scripts.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,028 |
Nodes: | 10 (0 / 10) |
Uptime: | 123:36:07 |
Calls: | 13,328 |
Files: | 186,574 |
D/L today: |
307 files (67,533K bytes) |
Messages: | 3,355,068 |