From: Jeff H. <je...@ac...> - 2011-02-25 01:26:24
|
That is a standard problem in that the "exactness" means that the release event will not get caught, and is picked up by the Table class binding. If you want to balance out your special binding, don't do all that extra cmd trickery, just add: bind .t.t <Control-ButtonRelease-1> { break } Jeff On 24/02/2011 7:50 AM, Robert Karen wrote: > sorry in my original email, I said 'rt click' a few times and meant to say > 'control-click'. here is corrected version: > > Can someone tell me what is going wrong here. I am trying to bind > to control-click to open a menu in a Tktable/Table and it continues > to catch the button-release in the table and select the cell beneath > the menu element selected. the code below stops it by modifying the > default bind for Table's ButtonRelease-1, but isn't there a standard > way of managing control click tk_popup menu where I shouldn't have to > modify the binding of Table? Thanks for any help. I ran this with > wish 8.5.7. > > package require Tktable > toplevel .t > table .t.t -variable var > pack .t.t > menu .t.m > .t.m add command -label First -command {puts "first..."} > .t.m add command -label Second -command {puts "second..."} > .t.m add command -label Third -command {tk_messageBox -message "third..."} > set bindCmd [bind Table<ButtonRelease-1>] > append cmd "if {\[info exists menuOpen\]} \{" > append cmd $bindCmd > append cmd "\}" > puts "new bind cmd for Table's ButtonRelease-1 = $cmd" > bind Table<ButtonRelease-1> $cmd > bind .t.t<Control-Button-1> { > set menuOpen 1 > tk_popup .t.m %X %Y > unset menuOpen > break > } |