From: Robert K. <ro...@cr...> - 2011-02-25 16:24:35
|
Thanks for the response. bind .t.t <Control-ButtonRelease-1> stops the Table from activating the table cell where I control-click to open the menu. I'm talking about something else. while the menu is opened if you click on one of the menu items, it activates the Table cell beneath that menu item after the popup menu closes. (This would be applicable if your menu command's labels are long enough to appear over a different Table cell than the one clicked on to open the menu.) I think the <ButtonRelease-1> of the Table is still firing after the menu is gone. Interestingly it only activates the cell after a delay, or until I touch the mouse. To stop that I have to bind .t.t <ButtonRelease-1> {break}, but that's a bind I need in Table for activating cells normally. RK On Thu, 24 Feb 2011 17:24:59 -0800 Jeff Hobbs <je...@ac...> wrote: > 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 >> } |