• Re: Tablelist bindings for popup menu

    From Martyn Smith@[email protected] to comp.lang.tcl on Thu Nov 6 08:43:51 2025
    From Newsgroup: comp.lang.tcl

    On 05/11/2025 10:40, nemethi wrote:
    Am 05.11.25 um 09:40 schrieb Martyn Smith:
    On 30/10/2025 21:51, nemethi wrote:
    Hi,
    Thanks That is what I was doing, but the 'AdvancedPopupMenu' was not
    being called at all.
    I will wait until we can update the version again and retest.

    Martyn
    Am 30.10.25 um 17:04 schrieb Martyn Smith:
    On 30/10/2025 16:21, Martyn Smith wrote:
    I have a tablelist which has some cells which contain mutli-line
    texts I use the following to add a popup menu on a right click

             # Add the bindings for the clipboard
             set body [$table bodypath]
             # Add clipboard menu
             bind $body <<Button3>> [list AdvancedPopupMenu %W %x %y %X
    %Y]

    This works on all cells except the multi-line cells.

    A button-1 press invokes the editstartcmd so some bindings are
    detected

    Is there some special binding needed or an update I'm fixed on
    tablelist 6.16 for reasons.

    Martyn
    For now I have found a workaround by binding to TablelistBody and
    ignoring any calls that come from other tablelists in the callback

    Change your code to become:

         set bodyTag [$table bodytag]
         bind $bodyTag <<Button3>> [list AdvancedPopupMenu %W %x %y %X %Y] >>>
         proc AdvancedPopupMenu {w x y rootX rootY} {
             # Get the tablelist widget and the cordinates relative to it
             lassign [tablelist::convEventFields $w $x $y] tbl x y
             ...

             set menu .menu
             # Populate the menu
             ...

             tk_popup $menu $rootX $rootY
         }



    Martyn, in your code you are using [$table bodypath], which doesn't work
    for a multi-line cell.  You have to use [$table bodytag] instead.

    Sorry My bad, Thanks for the help.

    Martyn
    --- Synchronet 3.21a-Linux NewsLink 1.2