In Files

  • tk/lib/tk/menuspec.rb

Class/Module Index [+]

Quicksearch

TkMenuSpec

tk/menuspec.rb

Hidethoshi NAGAI (nagai@ai.kyutech.ac.jp)

based on tkmenubar.rb :

Copyright (C) 1998 maeda shugo. All rights reserved. 
This file can be distributed under the terms of the Ruby.

The format of the menu_spec is:

[ menu_info, menu_info, ... ]

And the format of the menu_info is:

[
  [text, underline, configs], # menu button/entry (*1)
  [label, command, underline, accelerator, configs],   # command entry
  [label, TkVar_obj, underline, accelerator, configs], # checkbutton entry
  [label, [TkVar_obj, value], 
                     underline, accelerator, configs], # radiobutton entry
  [label, [[...menu_info...], [...menu_info...], ...], 
                     underline, accelerator, configs], # cascade entry (*2)
  '---', # separator
  ...
]

underline, accelerator, and configs are optional pearameters. Hashes are OK instead of Arrays. Then the entry type (‘command’, ‘checkbutton’, ‘radiobutton’ or ‘cascade’) is given by ‘type’ key (e.g. :type=>‘cascade’). When type is ‘cascade’, an array of menu_info is acceptable for ‘menu’ key (then, create sub-menu).

NOTE: (*1)

If you want to make special menus (*.help for UNIX, *.system for Win, 
and *.apple for Mac), append 'menu_name'=>name (name is 'help' for UNIX, 
'system' for Win, and 'apple' for Mac) option to the configs hash of 
menu button/entry information.

NOTE: (*2)

If you want to configure a cascade menu, add :menu_config=>{...configs..}
to the configs of the cascade entry.

Commenting is here to help enhance the documentation. For example, code samples, or clarification of the documentation.

If you have questions about Ruby or the documentation, please post to one of the Ruby mailing lists. You will get better, faster, help that way.

If you wish to post a correction of the docs, please do so, but also file bug report so that it can be corrected for the next release. Thank you.

If you want to help improve the Ruby documentation, please visit Documenting-ruby.org.

blog comments powered by Disqus