My favorites | English | Sign in

Faster apps faster - GWT 2.0 with Speed Tracer New!

Google SketchUp Ruby API

Menu

class

Parent: Object

Introduction

SketchUp 6.0+

An interface to a menu.

Methods

Menu.add_itemSketchUp 6.0+

The add_item menu item is used to add a menu item to the specified menu.

This method takes a block that defines the action to perform when the menu item is selected.

The item id that is returned can be used when adding an optional validation procedure for the menu item.

Arguments:

menu
A string name of the menu to add.
procedure
A method that will be invoked when the menu item is selected.

Returns:

item_id
a unique numerical item id for the menu
 plugins_menu = UI.menu("Plugins")
 item = plugins_menu.add_item("Test") { test }
 if (item)
   UI.messagebox item
 else
   UI.messagebox "Failure"
 end

Menu.add_separatorSketchUp 6.0+

The add_separator method is used to add a menu separator to a menu.

Returns:

nil
 plugins_menu = UI.menu("Plugins")
 plugins_menu.add_separator

Menu.add_submenuSketchUp 6.0+

The add_submenu method is used to add a sub-menu to a menu.

Returns:

submenu
a Menu object
 plugins_menu = UI.menu("Plugins")
 submenu = plugins_menu.add_submenu("Test")
 if (submenu)
   UI.messagebox submenu
 else
   UI.messagebox "Failure"
 end

Menu.set_validation_procSketchUp 6.0+

The set_validation_proc method is used to identify the menu validation procedure. Your procedure should return either MF_ENABLED, MF_DISABLED, MF_CHECKED, MF_UNCHECKED, or MF_GRAYED.

Arguments:

menu
A string name of the menu to add.
procedure
A method that will be invoked when the menu item is selected.

Returns:

item_id
a unique numerical item id for the menu
 plugins_menu = UI.menu("Plugins")
 item = plugins_menu.add_item("Test") { 
   return MF_GRAYEDTEST
 }
 UI.messagebox item
 begin
   status = plugins_menu.set_validation_proc(item)  { testProc }
 rescue
   UI.messagebox $!.message
 end