usual

class cc {
 inherit itk::Widget
 public method changtext 
 #array aar
 itk_option define -textbackground textBackground Background "\#ff0000"
 
 constructor {args} {
 itk_component add linetwo {
    button $itk_component(hull).d \
            -text "bbb"
 }
  
 itk_component add buttontwo {
    button $itk_component(hull).b \
            -text "est" \
            -command "$itk_component(hull) changtext ccc"
 } {
  usual
     keep -text
 }
  
 pack $itk_component(linetwo)
 pack $itk_component(buttontwo)
 }
}

body cc::changtext { args } {
 #set aar[1] 0;
 #puts $aar[1]
 .c.d configure -text $args
 .c.b configure -text $args
}


cc .c
pack .c

can not change buttontwo

====================================

class cc {
 inherit itk::Widget
 public method changtext 
 #array aar
 itk_option define -textbackground textBackground Background "\#ff0000"
 
 constructor {args} {
 itk_component add linetwo {
    button $itk_component(hull).d \
            -text "bbb"
 }
  
 itk_component add buttontwo {
    button $itk_component(hull).b \
            -text "est" \
            -command "$itk_component(hull) changtext ccc"
 } {
  usual 
     ignore -text
 }
  
 pack $itk_component(linetwo)
 pack $itk_component(buttontwo)
 }
}

body cc::changtext { args } {
 #set aar[1] 0;
 #puts $aar[1]
 .c.d configure -text $args
 .c.b configure -text $args
}


cc .c
pack .c


buttontwo can be changed

posted @ 2011-08-10 15:05  greencolor  阅读(166)  评论(0编辑  收藏  举报