Widget - toplevel menu

class menutest {
    inherit itk::Toplevel 
    constructor { args } {
 itk_option add hull.menu   
        wm title . "\[No image\"
        wm resizable . 1 1
 wm iconbitmap $itk_component(hull) [wm iconbitmap .]
 wm iconmask $itk_component(hull) [wm iconmask .]
 wm group $itk_component(hull) .
# wm protocol $itk_component(hull) \
               WM_DELETE_WINDOW [code $this hide]
        wm minsize . 600 200

 ### Menu bar and menus ####################################
 ###########################################################

 itk_component add menu {
     menu $itk_interior.menu \
  -tearoff 0 \
  -borderwidth 1
 }


 $itk_component(hull) configure \
  -menu $itk_component(menu)
 # Image menu ###############################################
 
 
 itk_component add imagemenu {
     menu $itk_interior.menu.image \
  -tearoff false \
  -relief raised \
  -borderwidth 1 \
  -activeborderwidth 0
 }

 $itk_component(menu) add cascade \
    -label "Image" \
  -menu $itk_component(imagemenu)  
      }
}
usual menutest {
 
}
#menutest .image

class menutwo {
 inherit itk::Widget
 constructor { args } { 
  wm withdraw .  
  itk_component add menutestt {
   menutest $itk_component(hull).t
  }
  
 }
}
menutwo .c
pack .c

posted @ 2011-08-12 09:50  greencolor  阅读(135)  评论(0编辑  收藏  举报