• Tablelist bindings for popup menu

    From Martyn Smith@Martyn.A.Smith@me.com to comp.lang.tcl on Thu Oct 30 16:21:27 2025
    From Newsgroup: comp.lang.tcl

    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
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Martyn Smith@Martyn.A.Smith@me.com to comp.lang.tcl on Thu Oct 30 17:04:01 2025
    From Newsgroup: comp.lang.tcl

    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
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From Harald Oehlmann@wortkarg3@yahoo.com to comp.lang.tcl on Thu Oct 30 17:10:58 2025
    From Newsgroup: comp.lang.tcl

    Am 30.10.2025 um 16:21 schrieb Martyn Smith:
    Martyn

    Martyn, you are still around, great! We met multiple times in ETCL in Strassbourg.

    Take care,
    Harald
    --- Synchronet 3.21a-Linux NewsLink 1.2
  • From nemethi@csaba.nemethi@t-online.de to comp.lang.tcl on Thu Oct 30 21:51:11 2025
    From Newsgroup: comp.lang.tcl

    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
    }
    --
    Csaba Nemethi https://www.nemethi.de mailto:csaba.nemethi@t-online.de
    --- Synchronet 3.21a-Linux NewsLink 1.2