class Iup::Menu
A menu is a collection of menu items, submenus, and separators. It is usually placed within a Dialog, or launched from an action, using popup.
This widget basically acts as a container for other menu widgets, but setting the radio attribute makes those other widgets act as a radio group.
Example
The following example creates open, save and exit menu items, and places them onto a menu. The save menu item is initially inactive. Notice the use of a separator, and how a SubMenu adds a clickable title to the file menu.
item_open = Iup::MenuItem.new('Open') item_save = Iup::MenuItem.new('Save') do |i| i.active = 'NO' end item_exit = Iup::MenuItem.new('Exit', ->{ Iup::CLOSE }) file_menu = Iup::Menu.new( item_open, item_save, Iup::Separator.new, item_exit) menu = Iup::Menu.new(Iup::SubMenu.new('File', file_menu))
Attributes
If set, makes children act as a radio group. Values βyesβ / βnoβ.
Native widget identifier.
Public Class Methods
Source
# File lib/wrapped/menu.rb, line 38 def initialize *widgets @handle = IupLib.IupMenu *widget_list(widgets) # run any provided block on instance, to set up further attributes yield self if block_given? end
Creates instance of a menu for given menu widgets. If a block is given, the new instance is yielded to it.
-
widgets- one or more menu items, sub menus or separators.
Callbacks
Attributes
Callback called just before the menu is opened. Callback must respond to call and take no arguments.