I used upvar, code
but an error cannot read $index is displayed
my question is how do i read a vriable from a class within out side the scope
ie
in a class i have a button like
class ee {
foreach item $images {
itk_component add button$index {
image create photo $index -file ./image/$item.gif
button $itk_interior.but$index -image $index -command {
set BUTTONCLICK button$index
# [ BUTTONCLICK is a variabe assiged by INITIALIZED]
#ie ::Toolbar .file [[ -variable BUTTONCLICK ]]
Button_click - # a proc out side this class
}
incr index
}
}
outside class
proc Button_Click { } {
global BUTTONCLICK
tk_messageBox -message "$BUTTONCLICK " -icon question
}
As soon as i click any button an error cannot read index is getting displayed
Thanks
Anil
but an error cannot read $index is displayed
my question is how do i read a vriable from a class within out side the scope
ie
in a class i have a button like
class ee {
foreach item $images {
itk_component add button$index {
image create photo $index -file ./image/$item.gif
button $itk_interior.but$index -image $index -command {
set BUTTONCLICK button$index
# [ BUTTONCLICK is a variabe assiged by INITIALIZED]
#ie ::Toolbar .file [[ -variable BUTTONCLICK ]]
Button_click - # a proc out side this class
}
incr index
}
}
outside class
proc Button_Click { } {
global BUTTONCLICK
tk_messageBox -message "$BUTTONCLICK " -icon question
}
As soon as i click any button an error cannot read index is getting displayed
Thanks
Anil