Bwidget Source Code
Check-in [229ceefb36]
Not logged in
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.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:t * listbox.tcl(ListBox::_configureSelectmode) Drag modifies multiple selection [Bug 2995969] reported by Robert Karen. Bound events on ButtonRelease-1 instead Button-1 for multiple selections to avoid bug. * listbox.tcl(ListBox::_drag_and_drop) The default drag and drop routine only handled single drag and drop. It was extended to handle also drag and drop of multiple entries.
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 229ceefb36d174639bc271bcd158baf4b5b2fbb3
User & Date: oehhar 2010-05-12 07:59:34
Context
2010-05-12
08:07
* listbox.tcl(ListBox::_configureSelectmode) Drag modifies multiple selection [Bug 2995969] reported by Robert Karen. Bound events on ButtonRelease-1 instead Button-1 for multiple selections to avoid bug. * listbox.tcl(ListBox::_drag_and_drop) The default drag and drop routine only handled single drag and drop. It was extended to handle also drag and drop of multiple entries. check-in: fb29756c0e user: oehhar tags: bwidget
07:59
t * listbox.tcl(ListBox::_configureSelectmode) Drag modifies multiple selection [Bug 2995969] reported by Robert Karen. Bound events on ButtonRelease-1 instead Button-1 for multiple selections to avoid bug. * listbox.tcl(ListBox::_drag_and_drop) The default drag and drop routine only handled single drag and drop. It was extended to handle also drag and drop of multiple entries. check-in: 229ceefb36 user: oehhar tags: bwidget
2009-09-03
17:29
* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly, when bigger than current screen [Bug 2850031] by Thomas Grausgruber Possible incompatibility: BWidget::place w h -> w,h are reduced to screen width check-in: 150292310b user: oehhar tags: bwidget
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to ChangeLog.











1
2
3
4
5
6
7









2009-09-03 Harald Oehlmann  <[email protected]>

	* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly,
	when bigger than current screen [Bug 2850031] by Thomas Grausgruber
	Possible incompatibility: BWidget::place w h -> w,h are reduced to
	screen width.

>
>
>
>
>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
2010-05-13 Harald Oehlmann < [email protected]>

	* listbox.tcl(ListBox::_configureSelectmode) Drag modifies
	multiple selection [Bug 2995969] reported by Robert Karen.
	Bound events on ButtonRelease-1 instead Button-1 for multiple
	selections to avoid bug.
	* listbox.tcl(ListBox::_drag_and_drop) The default drag and drop
	routine only handled single drag and drop.
	It was extended to handle also drag and drop of multiple entries.

2009-09-03 Harald Oehlmann  <[email protected]>

	* util.tcl(BWidget::place), BWidget.html Widget placed incorrectly,
	when bigger than current screen [Bug 2850031] by Thomas Grausgruber
	Possible incompatibility: BWidget::place w h -> w,h are reduced to
	screen width.

Changes to listbox.tcl.

1
2
3
4
5
6
7
8
9
10
11
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
....
1660
1661
1662
1663
1664
1665
1666
1667






1668









1669
1670
1671

1672
1673



1674
1675
1676
1677
1678
1679
1680
# ----------------------------------------------------------------------------
#  listbox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: listbox.tcl,v 1.29 2009/06/30 16:17:37 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ListBox::create
#     - ListBox::configure
#     - ListBox::cget
#     - ListBox::insert
#     - ListBox::itemconfigure
................................................................................
    # clear current binding
    switch -exact -- $previous {
        single {
            $path bindText  <Button-1> ""
            $path bindImage <Button-1> ""
        }
        multiple {
            $path bindText <Button-1>          ""
            $path bindText <Shift-Button-1>    ""
            $path bindText <Control-Button-1>  ""

            $path bindImage <Button-1>         ""
            $path bindImage <Shift-Button-1>   ""
            $path bindImage <Control-Button-1> ""
        }
    }
    # set new bindings
    switch -exact -- $selectmode {
        single {
            $path bindText  <Button-1> [list ListBox::_mouse_select $path set]
            $path bindImage <Button-1> [list ListBox::_mouse_select $path set]
            if {1 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
        multiple {
            set cmd ListBox::_multiple_select
            $path bindText <Button-1>          [list $cmd $path n %x %y]
            $path bindText <Shift-Button-1>    [list $cmd $path s %x %y]
            $path bindText <Control-Button-1>  [list $cmd $path c %x %y]

            $path bindImage <Button-1>         [list $cmd $path n %x %y]
            $path bindImage <Shift-Button-1>   [list $cmd $path s %x %y]
            $path bindImage <Control-Button-1> [list $cmd $path c %x %y]
        }
        default {
            if {0 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
    }
................................................................................
            set idx [$path index $i]
        }
        "widget" {
            set idx [llength $items]
        }
    }

    if {$idx > [$path index $startItem]} { incr idx -1 }
















    if {[string equal $operation "copy"]} {
        set options [Widget::options $path.$startItem]
        eval [linsert $options 0 $path insert $idx $startItem\#auto]

    } else {
        $path move $startItem $idx



    }
}


proc ListBox::_keyboard_navigation { path dir } {
    variable $path
    upvar 0  $path data


|







 







|
|
|

|
|
|













|
|
|

|
|
|







 







|
>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
>
|
|
|
>
|
|
>
>
>







1
2
3
4
5
6
7
8
9
10
11
...
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
....
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
# ----------------------------------------------------------------------------
#  listbox.tcl
#  This file is part of Unifix BWidget Toolkit
#  $Id: listbox.tcl,v 1.29.2.1 2010/05/12 07:59:34 oehhar Exp $
# ----------------------------------------------------------------------------
#  Index of commands:
#     - ListBox::create
#     - ListBox::configure
#     - ListBox::cget
#     - ListBox::insert
#     - ListBox::itemconfigure
................................................................................
    # clear current binding
    switch -exact -- $previous {
        single {
            $path bindText  <Button-1> ""
            $path bindImage <Button-1> ""
        }
        multiple {
            $path bindText <ButtonRelease-1>          ""
            $path bindText <Shift-ButtonRelease-1>    ""
            $path bindText <Control-ButtonRelease-1>  ""

            $path bindImage <ButtonRelease-1>         ""
            $path bindImage <Shift-ButtonRelease-1>   ""
            $path bindImage <Control-ButtonRelease-1> ""
        }
    }
    # set new bindings
    switch -exact -- $selectmode {
        single {
            $path bindText  <Button-1> [list ListBox::_mouse_select $path set]
            $path bindImage <Button-1> [list ListBox::_mouse_select $path set]
            if {1 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
        multiple {
            set cmd ListBox::_multiple_select
            $path bindText <ButtonRelease-1>          [list $cmd $path n %x %y]
            $path bindText <Shift-ButtonRelease-1>    [list $cmd $path s %x %y]
            $path bindText <Control-ButtonRelease-1>  [list $cmd $path c %x %y]

            $path bindImage <ButtonRelease-1>         [list $cmd $path n %x %y]
            $path bindImage <Shift-ButtonRelease-1>   [list $cmd $path s %x %y]
            $path bindImage <Control-ButtonRelease-1> [list $cmd $path c %x %y]
        }
        default {
            if {0 < [llength [ListBox::selection $path get]]} {
                ListBox::selection $path clear
            }
        }
    }
................................................................................
            set idx [$path index $i]
        }
        "widget" {
            set idx [llength $items]
        }
    }

    # Check if startItem is part of the current selection and process the
    # whole selection if so
    set selItems [selection $path get]
    if {-1 != [lsearch -exact $selItems $startItem]} {
        set dragItems $selItems
    } else {
        set dragItems [list $startItem]
    }

    # get drag indexes (to sort them)
	foreach dragItem $dragItems {
        lappend dragIdx [$path index $dragItem]
    }
    foreach pos [lsort -integer -indices $dragIdx] {
        set dragItem [lindex $dragItems $pos]
        set dragIdx [$path index $dragItem]
        if {$idx > $dragIdx} { incr idx -1 }
        if {[string equal $operation "copy"]} {
            set options [Widget::options $path.$dragItem]
            eval [linsert $options 0 $path insert $idx $dragItem\#auto]
            incr idx
        } else {
            $path move $dragItem $idx
            set idx [$path index $dragItem]
            incr idx
        }
    }
}


proc ListBox::_keyboard_navigation { path dir } {
    variable $path
    upvar 0  $path data