Tk Library Source Code

Check-in [f94f2c324b]
Login

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

Overview
Comment:Tsw: Guarded against the deletion of namespace qualifiers for the value of the "-variable" option.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: f94f2c324b051a50e91f857fff1c439b079f3ba424738f14bdc94374bbc05216
User & Date: csaba 2025-03-18 16:25:43.829
Context
2025-03-19
09:46
Tsw: Minor improvements in the documentation. check-in: 56b88914a8 user: csaba tags: trunk
2025-03-18
16:25
Tsw: Guarded against the deletion of namespace qualifiers for the value of the "-variable" option. check-in: f94f2c324b user: csaba tags: trunk
2025-03-17
14:00
Tsw: Minor cleanup in the reference manual. check-in: 4ac704f65d user: csaba tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to modules/tsw/scripts/toggleswitch.tcl.
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
proc tsw::makeVariable {win varName} {
    upvar ::tsw::ns${win}::data data
    if {$varName eq ""} {
	#
	# If there is an old variable associated with the
	# widget then remove the trace set on this variable
	#
	if {$data(-variable) ne ""} {
	    upvar #0 $data(-variable) oldVar
	    trace remove variable oldVar {write unset} $data(varTraceCmd)
	}
	return ""
    }

    #
    # The variable may be an array element but must not be an array







|
|







388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
proc tsw::makeVariable {win varName} {
    upvar ::tsw::ns${win}::data data
    if {$varName eq ""} {
	#
	# If there is an old variable associated with the
	# widget then remove the trace set on this variable
	#
	if {$data(-variable) ne "" &&
	    [catch {upvar #0 $data(-variable) oldVar}] == 0} {
	    trace remove variable oldVar {write unset} $data(varTraceCmd)
	}
	return ""
    }

    #
    # The variable may be an array element but must not be an array
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
	set name2 ""
    }

    #
    # If there is an old variable associated with the
    # widget then remove the trace set on this variable
    #
    if {$data(-variable) ne ""} {
	upvar #0 $data(-variable) oldVar
	trace remove variable oldVar {write unset} $data(varTraceCmd)
    }

    if {[info exists var]} {
	#
	# Invoke the trace procedure associated with the new variable
	#







|
|







412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
	set name2 ""
    }

    #
    # If there is an old variable associated with the
    # widget then remove the trace set on this variable
    #
    if {$data(-variable) ne "" &&
	[catch {upvar #0 $data(-variable) oldVar}] == 0} {
	trace remove variable oldVar {write unset} $data(varTraceCmd)
    }

    if {[info exists var]} {
	#
	# Invoke the trace procedure associated with the new variable
	#
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
#

#------------------------------------------------------------------------------
# tsw::onDestroy
#------------------------------------------------------------------------------
proc tsw::onDestroy win {
    upvar ::tsw::ns${win}::data data
    if {$data(-variable) ne ""} {
	upvar #0 $data(-variable) var
	trace remove variable var {write unset} $data(varTraceCmd)
    }

    namespace delete ::tsw::ns$win
    catch {rename ::$win ""}
}








|
|







648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
#

#------------------------------------------------------------------------------
# tsw::onDestroy
#------------------------------------------------------------------------------
proc tsw::onDestroy win {
    upvar ::tsw::ns${win}::data data
    if {$data(-variable) ne "" &&
	[catch {upvar #0 $data(-variable) var}] == 0} {
	trace remove variable var {write unset} $data(varTraceCmd)
    }

    namespace delete ::tsw::ns$win
    catch {rename ::$win ""}
}