Class: UI::Command
- Inherits:
- 
      Object
      
        - Object
- UI::Command
 
- Defined in:
- lib/sketchup-api-stubs/stubs/UI/Command.rb
Overview
The Command class is the preferred class for adding tools to the menus and Ruby toolbars. For example, you could add a menu item and pass it a code block directly, or you could first create a Command.
Using Commands gives you greater control over how the item works in the UI, and it allows multiple spots in the UI to call the same code. For example, You might want a toolbar button and a context-click menu item to both point to the same command, and to control the tooltip and its “graying” from a single spot in your code.
Class Method Summary collapse
- 
  
    
      .new(menutext) { ... } ⇒ UI::Command 
    
    
  
  
  
  
  
  
  
  
  
    The new method is used to create a new command. 
Instance Method Summary collapse
- 
  
    
      #large_icon  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The large_icon method returns the icon file for the command’s large icon. 
- 
  
    
      #large_icon=(path)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The large_icon= method is used to identify the icon file for the command’s large icon. 
- 
  
    
      #menu_text  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The menu_text method returns the menu item name for the command. 
- 
  
    
      #menu_text=(menuitem)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The menu_text= method is used to set the menu item name for the command. 
- 
  
    
      #set_validation_proc { ... } ⇒ UI::Command 
    
    
  
  
  
  
  
  
  
  
  
    The #set_validation_proc method allows you to change whether the command is enabled, checked, etc. 
- 
  
    
      #small_icon  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The small_icon method returns the icon file for the command’s small icon. 
- 
  
    
      #small_icon=(path)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The small_icon= method is used to identify the icon file for the command’s small icon. 
- 
  
    
      #status_bar_text  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The status_bar_text method returns the status bar text for the command. 
- 
  
    
      #status_bar_text=(text)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The status_bar_text= method is used to set the status bar text for the command. 
- 
  
    
      #tooltip  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The tooltip method returns command item’s tooltip text. 
- 
  
    
      #tooltip=(text)  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    The tooltip= method is used to define a command item’s tooltip text. 
Class Method Details
.new(menutext) { ... } ⇒ UI::Command
Prior to SketchUp 2019 it was not possible to sub-class UI::Command due to a bug in how SketchUp initialized the class.
The new method is used to create a new command.
| 65 66 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 65 def self.new() end | 
Instance Method Details
#large_icon ⇒ String
The large_icon method returns the icon file for the command’s large icon.
| 86 87 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 86 def large_icon end | 
#large_icon=(path) ⇒ String
The large_icon= method is used to identify the icon file for the command’s large icon. large icons should be 24x24 pixel images for best display quality.
Since SketchUp 2016 it is possible to provide vector images for the cursors. SVG format for Windows and PDF format for OS X. Since the vector images scale for both small and large icon sizes, you may choose to use only one vector image for both variants.
| 113 114 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 113 def large_icon=(path) end | 
#menu_text ⇒ String
The menu_text method returns the menu item name for the command.
| 130 131 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 130 def end | 
#menu_text=(menuitem) ⇒ String
The menu_text= method is used to set the menu item name for the command.
| 149 150 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 149 def () end | 
#set_validation_proc { ... } ⇒ UI::Command
The #set_validation_proc method allows you to change whether the command is enabled, checked, etc. based on the user state. For example, you might want your command to be disabled unless the user has a current selection.
| 179 180 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 179 def set_validation_proc end | 
#small_icon ⇒ String
The small_icon method returns the icon file for the command’s small icon.
| 198 199 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 198 def small_icon end | 
#small_icon=(path) ⇒ String
The small_icon= method is used to identify the icon file for the command’s small icon. Small icons should be 16x16 pixel images for best display quality.
Since SketchUp 2016 it is possible to provide vector images for the cursors. SVG format for Windows and PDF format for OS X. Since the vector images scale for both small and large icon sizes, you may choose to use only one vector image for both variants.
| 225 226 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 225 def small_icon=(path) end | 
#status_bar_text ⇒ String
The status_bar_text method returns the status bar text for the command.
| 246 247 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 246 def end | 
#status_bar_text=(text) ⇒ String
The status_bar_text= method is used to set the status bar text for the command.
| 269 270 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 269 def (text) end | 
#tooltip ⇒ String
The tooltip method returns command item’s tooltip text.
| 286 287 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 286 def tooltip end | 
#tooltip=(text) ⇒ String
The tooltip= method is used to define a command item’s tooltip text. Tooltips will appear when the command is attached to a tool bar and the user hovers their cursor over the icon.
| 307 308 | # File 'lib/sketchup-api-stubs/stubs/UI/Command.rb', line 307 def tooltip=(text) end |