I am using iwidget selectionbox in my project. I ran into a problem which is I can not get the value from the selection entry . The code is like following:
frame $c
iwidgets::selectionbox $c.sb -selectionlabel "Ports Number:" -itemslabel "Ports Numbwer" -height 2i -width 1.5i
pack $c.sb
$c.sb insert items end 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400
puts "port number is $port_num before "
set port_num [ $c.sb get ]
# $c.sb selection set 1 ;# default value
puts " port numb is $port_num"
The problem is [$c.sb get ] doesn't work. When I select a item from the list box the value appears in the entry but I can not get teh value by using get command. I can't find any way to get the value . Although it does work if I ran it from tkcon.tcl ( using source to load the file).
frame $c
iwidgets::selectionbox $c.sb -selectionlabel "Ports Number:" -itemslabel "Ports Numbwer" -height 2i -width 1.5i
pack $c.sb
$c.sb insert items end 2000 2100 2200 2300 2400 2500 2600 2700 2800 2900 3000 3100 3200 3300 3400
puts "port number is $port_num before "
set port_num [ $c.sb get ]
# $c.sb selection set 1 ;# default value
puts " port numb is $port_num"
The problem is [$c.sb get ] doesn't work. When I select a item from the list box the value appears in the entry but I can not get teh value by using get command. I can't find any way to get the value . Although it does work if I ran it from tkcon.tcl ( using source to load the file).