Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

TCL proc and arg quartion

Status
Not open for further replies.

roykrikke

Programmer
Dec 25, 2014
1
NL

I have the following tcl code.

Code:
proc add_led_control_component { led } {
      dashboard_add ${::led_control::dash_path} label_led_${led} label leds_group
      dashboard_set_property ${::led_control::dash_path} label_led_${led} text "Led ${led}"
      dashboard_add ${::led_control::dash_path} box_led_${led} comboBox leds_group
      dashboard_set_property ${::led_control::dash_path} box_led_${led} options { "Off" "On" "Blink fast" "Blink slow"}
      dashboard_set_property ${::led_control::dash_path} box_led_${led} onChange {::led_control::toggle ${led}}
}

If I call the above proc with:
Code:
::led_control::add_led_control_component 1

I get an error msg: can't read "led": no such variable while executing "::led_control::toggle ${led}".
Probably due to lack of TCL knowledge.

I don't understand why "dashboard_add ${::led_control::dash_path} label_led_${led} label leds_group" is working and why "dashboard_set_property ${::led_control::dash_path} box_led_${led} onChange {::led_control::toggle ${led}} is not.

Can some one explane this to me?
 
Bit of a swag here, but do you need
Code:
dashboard_set_property ${::led_control::dash_path} box_led_${led} onChange [b][u]$[/u][/b]{::led_control::toggle ${led}}
.. add a $ var ref to the last parameter? Try addding a "put 'xxx'" command inline and see if that parses out to the variable value you're after.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top