TCL Bwidget: How can i pass my Combobox selected value to the -command

964 views Asked by At

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!

1

There are 1 answers

3
nurdglaw On

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
}