hi ng,
i try to get a variable in bonding with listboxselect. i got a list shown in entry1 and the result schould be shown in entry2. i get an eror that the there is no such variable xyz. here is the code:
set list1 {1 2 3 4 5 6 7 8 9}
set list2 {a b c d e f g h i}
listbox .listbox
set list1_lenght [llength $list1]
for {set i 0} {$i <= $list1_lenght} {incr i} {
.listbox insert end [lindex $list1 $i]
}
entry .result -width 16 -relief sunken -textvariable result
pack .listbox .result
bind .listbox <<ListboxSelect>> {set xyz [selection get]} # here the variable xyv is set
set index [lsearch $list1 $xyz] # here the error occurs
set result [lindex $list2 $index]
why is the variable xyz not set ?
regards Reinhold
i try to get a variable in bonding with listboxselect. i got a list shown in entry1 and the result schould be shown in entry2. i get an eror that the there is no such variable xyz. here is the code:
set list1 {1 2 3 4 5 6 7 8 9}
set list2 {a b c d e f g h i}
listbox .listbox
set list1_lenght [llength $list1]
for {set i 0} {$i <= $list1_lenght} {incr i} {
.listbox insert end [lindex $list1 $i]
}
entry .result -width 16 -relief sunken -textvariable result
pack .listbox .result
bind .listbox <<ListboxSelect>> {set xyz [selection get]} # here the variable xyv is set
set index [lsearch $list1 $xyz] # here the error occurs
set result [lindex $list2 $index]
why is the variable xyz not set ?
regards Reinhold