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]] } 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