| 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: | 2026-11-21 10:49:14 | |
| 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
> }
| |||
| User Comments: |
serhiy.storchaka added on 2026-11-21 10:49:14:
Confirmed with the current swaplist on Tk 8.6 and 9.1: ::swaplist::Double looks for the buttons in the toplevel, which is the swaplist only without -embed. It also guesses the list from the path, so it chooses the wrong button if the path of the swaplist contains ".list1.". Proposed fix in branch swaplist-embed-double-click: instead of the patch, the double click bindings invoke the buttons of the swaplist directly. | |||
Attachments:
- swaplist.tcl.patch [download] added by anonymous on 2015-09-10 06:53:06. [details]
