Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

text tag binding and whole widget binding

13 views
Skip to first unread message

Luc Moulinier

unread,
May 5, 2011, 3:59:10 AM5/5/11
to
Hello !

I need some explainations about using simultaneously text tag binding
and whole widget bindings. See the script below :


proc gTag {w p} {
lassign [split [$w index $p] .] y x
$w tag add Mrk $y.$x $y.[expr {$x+1}]
puts "[$w index $p]"
}

pack [text .t -width 10 -height 10]
.t insert end [string repeat "012345679\n" 10]
.t tag configure toto -background green
.t tag add toto 2.4 2.8 4.4 4.8 6.4 6.8
.t tag bind toto <Control-1> {
puts "tag bind"
break
}
.t tag configure Mrk -foreground white -background blue
bind .t <1> {gTag %W @%x,%y}

According to the man pages, the text tag bindings are executed first,
and then the whole widget bindings. Executing the above script, if I
click on a green character, the two bindings fire, although a break is
pressent in the tag binding configuration.

What am I missing here ?

Thanks for your help !
Luc

Gerald W. Lester

unread,
May 5, 2011, 9:12:28 AM5/5/11
to

The "break" and "continue" only effect other bindings on the same "bindtags"
list -- what text and canvas do is effectively introduce a new "bindtags"
list for the items on the. Thus a break on a binding on an item does not
stop the widget binding from firing.


--
+------------------------------------------------------------------------+
| Gerald W. Lester, President, KNG Consulting LLC |
| Email: Gerald...@kng-consulting.net |
+------------------------------------------------------------------------+

Luc Moulinier

unread,
May 5, 2011, 10:27:21 AM5/5/11
to
On 5 mai, 15:12, "Gerald W. Lester" <Gerald.Les...@KnG-Consulting.net>
wrote:

I understand. Thank you Gerald ! Is their any workaround then ?

luc

0 new messages