Username: Password:

Perl/TkFAQ-10.19.怎样配置不让菜单被扯掉
来源:linux宝库作者:linux宝库 发布时间:2007-09-30 00:00:00


  原文:

  10.19. How do I obtain Menus that do not tear off?

  Nick Ing-Simmons outlined a couple of ways to achieve this result. The critical feature being the -tearoff => 0 configuration option of the Menu. In Nick’s words: my $mb = $parent->Menubutton(...); # The button my $menu = $mb->Menu(-tearoff => 0); # Create a non-tearoff menu $mb->configure(-menu => $menu); # Tell button to use it. $mb->command(....);

  Above is for clarity - you can loose $menu variable:

  my $mb = $parent->Menubutton(...); $mb->configure(-menu => $mb->Menu(-tearoff => 0)); $mb->command(....);

  译文:

  10.19. 怎样配置不让菜单被扯掉?

  Nick Ing-Simmons总结了两个实现的方法,但关键都是要使用Menu组件的配置选项-tearoff=>0。

  my $mb = $parent->Menubutton(...); # 菜单按钮

  my $menu = $mb->Menu(-tearoff => 0); # 创建一个不能被扯掉的菜单

  $mb->configure(-menu => $menu); # 让按钮使用他

  $mb->command(....);

  上面的例子只是为了说明的清楚,您也能够不使用$menu变量:

  my $mb = $parent->Menubutton(...);

  $mb->configure(-menu => $mb->Menu(-tearoff => 0));

  $mb->command(....);

喜欢本文,那就收藏到:

    Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网
相关评论  我也要评论
还没有关于此文章的相关评论!
  • 昵称: (为空则显示guest)
  • 评论分数: ★ ★ ★★★ ★★★★ ★★★★★
  • 评论内容:(不能超过250字,需审核后才会公布,请自觉遵守互联网相关政策法规。
  • 导航
    赞助商
    文章类别
    订阅