Bwidget Source Code
Check-in [67d6d7d3b3]
Not logged in

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

Overview
Comment:ListBox update, border with images and image selection fixed [ff1787af9c]
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | bwidget
Files: files | file ages | folders
SHA1: 67d6d7d3b3f3328e1b906fa45a39e9ed44f4cd62
User & Date: oehhar 2013-10-14 15:53:50.226
References
2014-01-21
13:15 Closed ticket [ff1787af9c]: 3 listbox issues: missing update, image selection and border size plus 7 other changes artifact: 28b04e1294 user: oehhar
Context
2013-10-14
15:59
ScrolledWindow: raise scrolled window if below in window hierarchy [6632134ce9] check-in: 10c00fc4fb user: oehhar tags: bwidget
15:53
ListBox update, border with images and image selection fixed [ff1787af9c] check-in: 67d6d7d3b3 user: oehhar tags: bwidget
15:28
Fix combobox failure in themed mode [cc3b12e22f] check-in: 9c20e19e15 user: oehhar tags: bwidget
Changes
Unified Diff Ignore Whitespace Patch
Changes to ChangeLog.
1
2
3
4
5






6
7
8
9
10
11
12
2013-10-07 Harald Oehlmann <[email protected]>
	combobox.tcl: Fails in themed mode with "unknown
	option -bg". Patch solves this but listbox items
	are white on white when "-foreground" is specified.
	By Wolfgang S. Kechel. Ticket [cc3b12e22f]







2013-10-07 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Sometimes the tooltip does not occur under
	gnome/metacity on ubuntu. By Wolfgang S. Kechel.
	Ticket [a588d2f800]

2013-09-15 Harald Oehlmann <[email protected]>





>
>
>
>
>
>







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
2013-10-07 Harald Oehlmann <[email protected]>
	combobox.tcl: Fails in themed mode with "unknown
	option -bg". Patch solves this but listbox items
	are white on white when "-foreground" is specified.
	By Wolfgang S. Kechel. Ticket [cc3b12e22f]
	
	listbox.tcl: Update on option -deltay added.
	Set x0 to 2 to make highlight work and look nice for
	listbox with image.
	Take image into account to show selection.
	By Wolfgang S. Kechel. Ticket [ff1787af9c]

2013-10-07 Harald Oehlmann <[email protected]>
	dynhelp.tcl: Sometimes the tooltip does not occur under
	gnome/metacity on ubuntu. By Wolfgang S. Kechel.
	Ticket [a588d2f800]

2013-09-15 Harald Oehlmann <[email protected]>
Changes to listbox.tcl.
236
237
238
239
240
241
242
243

244
245
246
247
248
249
250
251
252

253

254
255
256
257
258
259
260
    set selectmodePrevious [Widget::getoption $path -selectmode]
    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -selectmode selectmode] } {
        _configureSelectmode $path $selectmode $selectmodePrevious
    }

    set ch1 [expr {[Widget::hasChanged $path -deltay dy]  |

                   [Widget::hasChanged $path -padx val]   |
                   [Widget::hasChanged $path -multicolumn val]}]

    set ch2 [expr {[Widget::hasChanged $path -selectbackground val] |
                   [Widget::hasChanged $path -selectforeground val]}]

    set redraw 0
    if { [Widget::hasChanged $path -height h] } {
        $path.c configure -height [expr {$h*$dy}]

        set redraw 1

    }
    if { [Widget::hasChanged $path -width w] } {
        $path.c configure -width [expr {$w*8}]
        set redraw 1
    }

    if { [Widget::hasChanged $path -background bg] } {







|
>







|

>
|
>







236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
    set selectmodePrevious [Widget::getoption $path -selectmode]
    set res [Widget::configure $path $args]

    if { [Widget::hasChanged $path -selectmode selectmode] } {
        _configureSelectmode $path $selectmode $selectmodePrevious
    }

    set ch0 [expr {[Widget::hasChanged $path -deltay dy]}]
    set ch1 [expr {$ch0  |
                   [Widget::hasChanged $path -padx val]   |
                   [Widget::hasChanged $path -multicolumn val]}]

    set ch2 [expr {[Widget::hasChanged $path -selectbackground val] |
                   [Widget::hasChanged $path -selectforeground val]}]

    set redraw 0
    if { [Widget::hasChanged $path -height h] || $ch0 } {
        $path.c configure -height [expr {$h*$dy}]
        if {!$ch0} {
            set redraw 1
        }
    }
    if { [Widget::hasChanged $path -width w] } {
        $path.c configure -width [expr {$w*8}]
        set redraw 1
    }

    if { [Widget::hasChanged $path -background bg] } {
1042
1043
1044
1045
1046
1047
1048

1049
1050
1051
1052
1053
1054
1055
1056
    set cursor [$path.c cget -cursor]
    $path.c configure -cursor watch
    update idletasks ; # make sure watch cursor is reflected
    set dx   [Widget::getoption $path -deltax]
    set dy   [Widget::getoption $path -deltay]
    set padx [Widget::getoption $path -padx]
    set y0   [expr {$dy/2}]

    set x0   4
    set x1   [expr {$x0+$padx}]
    set nitem 0
    set width 0
    set drawn {}
    set data(xlist) {}
    if { [Widget::cget $path -multicolumn] } {
        set nrows $data(nrows)







>
|







1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
    set cursor [$path.c cget -cursor]
    $path.c configure -cursor watch
    update idletasks ; # make sure watch cursor is reflected
    set dx   [Widget::getoption $path -deltax]
    set dy   [Widget::getoption $path -deltay]
    set padx [Widget::getoption $path -padx]
    set y0   [expr {$dy/2}]
    # Changed from 4 to 2 to make highlight work and look nice for listbox with image as well
    set x0   2
    set x1   [expr {$x0+$padx}]
    set nitem 0
    set width 0
    set drawn {}
    set data(xlist) {}
    if { [Widget::cget $path -multicolumn] } {
        set nrows $data(nrows)
1123
1124
1125
1126
1127
1128
1129









1130
1131
1132
1133
1134
1135
1136
    if {$selfill && !$multi} {
	# cache window width for use below
	set width [winfo width $path]
    }
    foreach item $data(selitems) {
        set bbox [$path.c bbox "n:$item"]
        if { [llength $bbox] } {









	    if { $selfill && !$multi } {
		# With -selectfill, make box occupy full width of widget
		set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
	    }
            set tags [list sel s:$item click clickbind]
            set id [$path.c create rectangle $bbox \
                -fill $selbg -outline $selbg -tags $tags]







>
>
>
>
>
>
>
>
>







1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
    if {$selfill && !$multi} {
	# cache window width for use below
	set width [winfo width $path]
    }
    foreach item $data(selitems) {
        set bbox [$path.c bbox "n:$item"]
        if { [llength $bbox] } {
            set imgbox [$path.c bbox i:$item]
            lassign $bbox x0 y0 x1 y1;
            if {[string compare "" $imgbox]} {
                # image may exist and may be heigher than text!
                lassign $imgbox ix0 iy0 ix1 iy1;
                set bbox [list $x0 [expr {min($iy0,$y0)}] $x1 [expr {max($iy1,$y1)}]];
            } else {
                set bbox [list $x0 [lindex $bbox 1] $x1 [lindex $bbox 3]]
            }
	    if { $selfill && !$multi } {
		# With -selectfill, make box occupy full width of widget
		set bbox [list 0 [lindex $bbox 1] $width [lindex $bbox 3]]
	    }
            set tags [list sel s:$item click clickbind]
            set id [$path.c create rectangle $bbox \
                -fill $selbg -outline $selbg -tags $tags]