source keyedListLib.tcl ################################################################ # proc appendToKeyList {}-- # Append a pair of values to the keyList # Arguments # NONE # # Results # global variables key and keyList are modified. # proc appendToKeyList {} { global keyList global key set keyList [appendKeyedPair $keyList [incr key] $key] } ################################################################ # proc testGetVal {}-- # retrieve the value associated with successive keys # Arguments # NONE # # Results # Modifies global variables testKey and testKeyVal # proc testGetVal {} { global testKey global testKeyVal global keyList set testKeyVal [getValue $keyList [incr testKey]] } proc testDeleteElement {} { global testDelete global keyList set keyList [deleteElement $keyList [incr testDelete]] } proc testReplaceValue {} { global testReplace global keyList set newVal $testReplace set keyList [replaceValue $keyList [incr testReplace] $newVal] } set testDelete 1 set testReplace 1 set testKey 1 set key 1 set keyList {} set row 1 set column 1 set w [button .b_addPair -text "Add Pair" \ -command appendToKeyList] grid $w -row $row -column $column incr column set w [label .l_keyList -textvariable keyList -width 50] grid $w -row $row -column $column -columnspan 3 incr row set column 1 set w [button .b_getVal -text "Test Next Key" \ -command testGetVal] grid $w -row $row -column $column incr column set w [label .l_testkey -textvariable testKey -width 5 -background gray75] grid $w -row $row -column $column incr column set w [label .l_testkeyVal -textvariable testKeyVal -width 5 -background gray75] grid $w -row $row -column $column set column 1 incr row set w [button .b_deleteElem -text "Test Delete" -command testDeleteElement] grid $w -row $row -column $column incr column set w [button .b_replaceVal -text "Test Replace" -command testReplaceValue] grid $w -row $row -column $column incr column