Tk Library Source Code

View Ticket
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.
Ticket UUID: 42622db1989d34f6a8df17e19854d0e5a57a1b7
Title: Patch to the swaplist default <Double-Button-1> binding that causes an error with -embed option
Type: Patch Version: 0.2
Submitter: anonymous Created on: 2015-09-10 06:52:43
Subsystem: tklib :: swaplist Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2015-09-10 06:52:43
Resolution: None Closed By: nobody
    Closed on:
Description:
## Example code
package require swaplist

toplevel .t
swaplist::swaplist .t.swl sels {a b c} {d e} -embed
pack .t.swl

## If you double click the left listbox, the error dialog is displayed.

# invalid command name ".t.lr.left"
#     while executing
# "$top.lr.left invoke"
#     (procedure "::swaplist::Double" line 6)
#     invoked from within
# "::swaplist::Double .t.swl.list2.list"
#     (command bound to event)

## Patch to this issue

172,173c172,173
<     bind $w.list1.list <Double-Button-1> [list ::swaplist::Double %W]
<     bind $w.list2.list <Double-Button-1> [list ::swaplist::Double %W]
---
>     bind $w.list1.list <Double-Button-1> [list ::swaplist::Double $w 1]
>     bind $w.list2.list <Double-Button-1> [list ::swaplist::Double $w 2]
350,356c350,355
< proc ::swaplist::Double {w} {
<     set top [winfo toplevel $w]
<     if {[string match *.list1.* $w]} {
<         $top.lr.right invoke
<     } elseif {[string match *.list2.* $w]} {
<         $top.lr.left invoke
<     }
---
> proc ::swaplist::Double {w side} {
> 	if {$side == 1} {
>         $w.lr.right invoke
> 	} elseif {$side == 2} {
>         $w.lr.left invoke
> 	}

Attachments: