Tk Library Source Code

Artifact [9253c212fe]
Login

Artifact 9253c212fe35a0e66e1051d711ceb8a6826161d8:

Attachment "listbox.patch" to ticket [483838ffff] added by decosterjos 2002-09-09 15:22:05.
Index: listbox.tcl
===================================================================
RCS file: /cvsroot/tcllib/bwidget/listbox.tcl,v
retrieving revision 1.8
diff -r1.8 listbox.tcl
159,164c159,164
< 	    $path bindText <Button-1>         [list ListBox::_multiple_select $path n]
< 	    $path bindText <Control-Button-1> [list ListBox::_multiple_select $path c]
< 	    $path bindText <Shift-Button-1>   [list ListBox::_multiple_select $path s]
< 	    $path bindImage <Button-1>         [list ListBox::_multiple_select $path n]
< 	    $path bindImage <Control-Button-1> [list ListBox::_multiple_select $path c]
< 	    $path bindImage <Shift-Button-1>   [list ListBox::_multiple_select $path s]
---
> 	    $path bindText <Button-1>         [list ListBox::_multiple_select $path n %x %y]
> 	    $path bindText <Control-Button-1> [list ListBox::_multiple_select $path c %x %y]
> 	    $path bindText <Shift-Button-1>   [list ListBox::_multiple_select $path s %x %y]
> 	    $path bindImage <Button-1>         [list ListBox::_multiple_select $path n %x %y]
> 	    $path bindImage <Control-Button-1> [list ListBox::_multiple_select $path c %x %y]
> 	    $path bindImage <Shift-Button-1>   [list ListBox::_multiple_select $path s %x %y]
1287a1288,1323
>     set xmax   [winfo width  $path]
>     set ymax   [winfo height $path]
>     set scroll {}
>     if { $y <= 6 } {
>         if { [lindex [$path.c yview] 0] > 0 } {
>             set scroll [list yview -1]
>             DropSite::setcursor sb_up_arrow
>         }
>     } elseif { $y >= $ymax-6 } {
>         if { [lindex [$path.c yview] 1] < 1 } {
>             set scroll [list yview 1]
>             DropSite::setcursor sb_down_arrow
>         }
>     } elseif { $x <= 6 } {
>         if { [lindex [$path.c xview] 0] > 0 } {
>             set scroll [list xview -1]
>             DropSite::setcursor sb_left_arrow
>         }
>     } elseif { $x >= $xmax-6 } {
>         if { [lindex [$path.c xview] 1] < 1 } {
>             set scroll [list xview 1]
>             DropSite::setcursor sb_right_arrow
>         }
>     }
> 
>     if { [string length $data(dnd,afterid)] && [string compare $data(dnd,scroll) $scroll] } {
>         after cancel $data(dnd,afterid)
>         set data(dnd,afterid) ""
>     }
> 
>     set data(dnd,scroll) $scroll
>     if { [llength $scroll] && ![string length $data(dnd,afterid)] } {
>         set data(dnd,afterid) [after 200 ListBox::_scroll $path $scroll]
>     }
>     return $data(dnd,afterid)
> 
1293c1329
< proc ListBox::_multiple_select { path mode idx } {
---
> proc ListBox::_multiple_select { path mode x y idx } {
1341,1376d1376
< 
<     set xmax   [winfo width  $path]
<     set ymax   [winfo height $path]
<     set scroll {}
<     if { $y <= 6 } {
<         if { [lindex [$path.c yview] 0] > 0 } {
<             set scroll [list yview -1]
<             DropSite::setcursor sb_up_arrow
<         }
<     } elseif { $y >= $ymax-6 } {
<         if { [lindex [$path.c yview] 1] < 1 } {
<             set scroll [list yview 1]
<             DropSite::setcursor sb_down_arrow
<         }
<     } elseif { $x <= 6 } {
<         if { [lindex [$path.c xview] 0] > 0 } {
<             set scroll [list xview -1]
<             DropSite::setcursor sb_left_arrow
<         }
<     } elseif { $x >= $xmax-6 } {
<         if { [lindex [$path.c xview] 1] < 1 } {
<             set scroll [list xview 1]
<             DropSite::setcursor sb_right_arrow
<         }
<     }
< 
<     if { [string length $data(dnd,afterid)] && [string compare $data(dnd,scroll) $scroll] } {
<         after cancel $data(dnd,afterid)
<         set data(dnd,afterid) ""
<     }
< 
<     set data(dnd,scroll) $scroll
<     if { [llength $scroll] && ![string length $data(dnd,afterid)] } {
<         set data(dnd,afterid) [after 200 ListBox::_scroll $path $scroll]
<     }
<     return $data(dnd,afterid)