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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Again Obejet Oriented Programing Problem

Status
Not open for further replies.

akpr

Programmer
Jul 25, 2001
19
US
Thanks for helping to solve the problem


Now i have one more problem related with OOPS.
I create a class for toolbar it calls as follows

::clsToolbar .frmToolbar.file -maxbutton 3 -variable BUTTONNAME
pack .frmToolbar -side top -fill x

now I want to store the button's name in the global variable BUTTONNAME as soon as that button is clicked
so I can identify which button is clicked
suppose there are 3 button in the toolbar
new, open and save
if new is clicked the variable for [BUTTONNAME] should be new

I tried at my level best

I would be happy if u help me to solve this problem
thanks
akpr
 
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
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top