0

May i know how to pass my selected value from the combobox to A_task through -command? For example, if i selected 3 in the combobox, then i want to pass this value to my A_task proc

ComboBox .combo -values {"0" "1" "2" "3" "4" "5" \
                -helptext "Please select your options" \
            -command A_task

proc A_Task {value} {
   # Do something here
}

Thanks for the help!

fpga89
  • 1

1 Answers1

0

There's good news and bad news.

Bad news: you can't.

Good news: What you need to do instead is to get the command handler to ask the widget for the value, so your A_Task proc should look something like this:

proc A_Task {} {
    set value [.combo get]
    # Do somethng here
}
nurdglaw
  • 2,107
  • 19
  • 37
  • Thanks for your quick response! But it is not working :( is it i missed out anything? – fpga89 Jul 02 '13 at 14:43
  • Please describe the failure message, if any. – Donal Fellows Jul 02 '13 at 14:43
  • Seem like that is not working :( Is it i missed up something? ComboBox .combo -values {"0" "1" "2" "3" "4" "5" \ -helptext "Please select your options" \ -command A_task proc A_Task {} { set value [.combo get] puts $value } – fpga89 Jul 02 '13 at 14:52