Tk Library Source Code
Check-in [5ae040fd4f]
Not logged in
Bounty program for improvements to Tcl and certain Tcl packages.

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

Overview
Comment: * scripts/tablelistUtil.tcl: Worked around a peculiarity of Tk on * scripts/tablelistWidget.tcl: Windows, related to deleting an embedded window while resizing a text widget interactively.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:5ae040fd4f5bede140d0f9b455814a2f3b55ed64
User & Date: csaba 2013-04-21 15:58:35
Context
2013-04-21
16:01
* CHANGES.txt: Slightly extended. * doc/tablelistWidget.html: check-in: 4330d1da33 user: csaba tags: trunk
15:58
* scripts/tablelistUtil.tcl: Worked around a peculiarity of Tk on * scripts/tablelistWidget.tcl: Windows, related to deleting an embedded window while resizing a text widget interactively. check-in: 5ae040fd4f user: csaba tags: trunk
15:57
* scripts/tablelistBind.tcl: Minor improvement. check-in: 0642e95299 user: csaba tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to modules/tablelist/scripts/tablelistUtil.tcl.

1495
1496
1497
1498
1499
1500
1501











1502
1503
1504
1505
1506
1507
1508
....
1509
1510
1511
1512
1513
1514
1515
1516

1517
1518

1519
1520
1521
1522


1523
1524
1525
1526
1527
1528
1529
1530
1531
1532

1533
1534
1535

1536
1537
1538
1539


1540
1541
1542













1543
1544
1545
1546
1547
1548
1549
....
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107

3108
3109
3110
3111
3112
3113
3114
....
3171
3172
3173
3174
3175
3176
3177
3178

3179
3180
3181
3182
3183
3184
3185
....
4464
4465
4466
4467
4468
4469
4470
4471
4472
4473



4474

4475
4476
4477
4478
4479
4480
4481
	if {[insertOrUpdateIndent $w $index1 $indent $indentWidth]} {
	    set index2 $index2+1c
	}
	set index1 $index1+1c
    }

    if {$auxWidth == 0} {				;# no image or window











	if {$::tk_version >= 8.5} {
	    $w replace $index1 $index2 $text
	} else {
	    $w delete $index1 $index2
	    $w insert $index1 $text
	}
    } else {
................................................................................
	#
	# Check whether the image label or the frame containing a
	# window is mapped at the first or last position of the cell
	#
	if {$auxType == 1} {					;# image
	    if {[setImgLabelWidth $w $index1 $auxWidth]} {
		set auxFound 1
		$w delete $index1+1c $index2

	    } elseif {[setImgLabelWidth $w $index2-1c $auxWidth]} {
		set auxFound 1

		$w delete $index1 $index2-1c
	    } else {
		set auxFound 0
		$w delete $index1 $index2


	    }
	} else {						;# window
	    if {[$aux cget -width] != $auxWidth} {
		$aux configure -width $auxWidth
	    }

	    if {[string compare [lindex [$w dump -window $index1] 1] \
		 $aux] == 0} {
		set auxFound 1
		$w delete $index1+1c $index2

	    } elseif {[string compare [lindex [$w dump -window $index2-1c] 1] \
		       $aux] == 0} {
		set auxFound 1

		$w delete $index1 $index2-1c
	    } else {
		set auxFound 0
		$w delete $index1 $index2


	    }
	}














	if {$auxFound} {
	    #
	    # Adjust the aux. window and insert the text
	    #
	    if {[string compare $alignment "right"] == 0} {
		if {$auxType == 1} {				;# image
		    setImgLabelAnchor $w $index1 e
................................................................................
	    }
	}

	incr col
    }

    #
    # Adjust the columns
    #
    adjustColumns $win {} 0

}

#------------------------------------------------------------------------------
# tablelist::moveActiveTag
#
# Moves the "active" tag to the line or cell that displays the active item or
# element of the tablelist widget win in its body text child.
................................................................................
	    after cancel $data(colorId)
	    unset data(colorId)
	}
    } else {
	set updateAll 0
    }

    if {$data(itemCount) == 0 || $data(colCount) == 0} {

	return ""
    }

    if {$updateAll} {
	if {$data(isDisabled)} {
	    $w tag add disabled $fromTextIdx $toTextIdx
	}
................................................................................

#------------------------------------------------------------------------------
# tablelist::updateViewWhenIdle
#
# Arranges for the visible part of the tablelist widget win to be updated
# at idle time.
#------------------------------------------------------------------------------
proc tablelist::updateViewWhenIdle win {
    upvar ::tablelist::ns${win}::data data
    if {[info exists data(viewId)]} {



	return ""

    }

    set data(viewId) [after idle [list tablelist::updateView $win]]
}

#------------------------------------------------------------------------------
# tablelist::updateView







>
>
>
>
>
>
>
>
>
>
>







 







|
>


>
|


<
>
>









|
>



>
|


<
>
>



>
>
>
>
>
>
>
>
>
>
>
>
>







 







|


>







 







|
>







 







|


>
>
>
|
>







1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
....
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534

1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554

1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
....
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
....
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
....
4496
4497
4498
4499
4500
4501
4502
4503
4504
4505
4506
4507
4508
4509
4510
4511
4512
4513
4514
4515
4516
4517
	if {[insertOrUpdateIndent $w $index1 $indent $indentWidth]} {
	    set index2 $index2+1c
	}
	set index1 $index1+1c
    }

    if {$auxWidth == 0} {				;# no image or window
	#
	# Work around a Tk peculiarity on Windows, related to deleting
	# an embedded window while resizing a text widget interactively
	#
	set path [lindex [$w dump -window $index1] 1]
	if {[string compare $path ""] != 0 &&
	    [string compare [winfo class $path] "Message"] == 0} {
	    $path configure -text ""
	    $w window configure $index1 -window ""
	}

	if {$::tk_version >= 8.5} {
	    $w replace $index1 $index2 $text
	} else {
	    $w delete $index1 $index2
	    $w insert $index1 $text
	}
    } else {
................................................................................
	#
	# Check whether the image label or the frame containing a
	# window is mapped at the first or last position of the cell
	#
	if {$auxType == 1} {					;# image
	    if {[setImgLabelWidth $w $index1 $auxWidth]} {
		set auxFound 1
		set fromIdx $index1+1c
		set toIdx $index2
	    } elseif {[setImgLabelWidth $w $index2-1c $auxWidth]} {
		set auxFound 1
		set fromIdx $index1
		set toIdx $index2-1c
	    } else {
		set auxFound 0

		set fromIdx $index1
		set toIdx $index2
	    }
	} else {						;# window
	    if {[$aux cget -width] != $auxWidth} {
		$aux configure -width $auxWidth
	    }

	    if {[string compare [lindex [$w dump -window $index1] 1] \
		 $aux] == 0} {
		set auxFound 1
		set fromIdx $index1+1c
		set toIdx $index2
	    } elseif {[string compare [lindex [$w dump -window $index2-1c] 1] \
		       $aux] == 0} {
		set auxFound 1
		set fromIdx $index1
		set toIdx $index2-1c
	    } else {
		set auxFound 0

		set fromIdx $index1
		set toIdx $index2
	    }
	}

	#
	# Work around a Tk peculiarity on Windows, related to deleting
	# an embedded window while resizing a text widget interactively
	#
	set path [lindex [$w dump -window $fromIdx] 1]
	if {[string compare $path ""] != 0 &&
	    [string compare [winfo class $path] "Message"] == 0} {
	    $path configure -text ""
	    $w window configure $fromIdx -window ""
	}

	$w delete $fromIdx $toIdx

	if {$auxFound} {
	    #
	    # Adjust the aux. window and insert the text
	    #
	    if {[string compare $alignment "right"] == 0} {
		if {$auxType == 1} {				;# image
		    setImgLabelAnchor $w $index1 e
................................................................................
	    }
	}

	incr col
    }

    #
    # Adjust the columns and schedule a view update for execution at idle time
    #
    adjustColumns $win {} 0
    updateViewWhenIdle $win 1
}

#------------------------------------------------------------------------------
# tablelist::moveActiveTag
#
# Moves the "active" tag to the line or cell that displays the active item or
# element of the tablelist widget win in its body text child.
................................................................................
	    after cancel $data(colorId)
	    unset data(colorId)
	}
    } else {
	set updateAll 0
    }

    if {$data(itemCount) == 0 || $data(colCount) == 0 ||
	[info exists data(dispId)]} {
	return ""
    }

    if {$updateAll} {
	if {$data(isDisabled)} {
	    $w tag add disabled $fromTextIdx $toTextIdx
	}
................................................................................

#------------------------------------------------------------------------------
# tablelist::updateViewWhenIdle
#
# Arranges for the visible part of the tablelist widget win to be updated
# at idle time.
#------------------------------------------------------------------------------
proc tablelist::updateViewWhenIdle {win {reschedule 0}} {
    upvar ::tablelist::ns${win}::data data
    if {[info exists data(viewId)]} {
	if {$reschedule} {
	    after cancel $data(viewId)
	} else {
	    return ""
	}
    }

    set data(viewId) [after idle [list tablelist::updateView $win]]
}

#------------------------------------------------------------------------------
# tablelist::updateView

Changes to modules/tablelist/scripts/tablelistWidget.tcl.

4913
4914
4915
4916
4917
4918
4919

4920
4921
4922
4923
4924
4925
4926
		unset data($key,$col-reqHeight)
		incr data(winCount) -1
	    }
	    if {[info exists data($key,$col-indent)]} {
		unset data($key,$col-indent)
		incr data(indentCount) -1
	    }

	}

	foreach name [array names attribs $key,*-*] {
	    unset attribs($name)
	}

	set textIdx2 $textIdx1







>







4913
4914
4915
4916
4917
4918
4919
4920
4921
4922
4923
4924
4925
4926
4927
		unset data($key,$col-reqHeight)
		incr data(winCount) -1
	    }
	    if {[info exists data($key,$col-indent)]} {
		unset data($key,$col-indent)
		incr data(indentCount) -1
	    }
	    destroy $w.msg_$key,$col
	}

	foreach name [array names attribs $key,*-*] {
	    unset attribs($name)
	}

	set textIdx2 $textIdx1