• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Programing menu icons

Scheduled Pinned Locked Moved Developers' Forum
3 Posts 2 Posters 229 Views 2 Watching
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    honoluludesktop
    last edited by 6 Nov 2010, 01:59

    Can anyone point me to very simple examples of menu icons, and tell me what to look for. The following is the code used for my menus, is this where I begin to add code to set up the use of icons?

    unless file_loaded? File;;basename(__FILE__)
      add_separator_to_menu("File")	
      UI.menu("File").add_item("Select Component") {hdt_sel_comp}
      file_loaded File;;basename(__FILE__)
    end
    
    1 Reply Last reply Reply Quote 0
    • D Offline
      Didier Bur
      last edited by 6 Nov 2010, 07:17

      Hi,

      If you mean a toolbar, here is a typical code block:

      
        arcs_tb = UI;;Toolbar.new("Arcs")  #declare the toolbar object
        
        cmd = UI;;Command.new(("Arc-Circle; 3 Points")) { Arc3pts.tool } #create a new command object 'cmd' that launches the tool within the {}
        cmd.small_icon = "3parc2.png" #set this new command a small icon image (users sets this in the preferences dialog)
        cmd.large_icon = "3parc.png" #set this new command a large icon image (users sets this in the preferences dialog)
        cmd.tooltip = "Draw an arc or circle with 3 points" #create a tooltip when hovering the icon
        arcs_tb.add_item(cmd) #add the command 'cmd' to the toolbar object
        
      

      You can put the toolbar code (for instance) after your menu settings:

      if (not file_loaded?("myScript.rb"))

      menu = UI.menu("Plugins")
      my_menu=menu.add_submenu("my submenu label")
      my_menu.add_item("Here we go !") { cmd_to_launch }
      

      ...
      ...
      arcs_tb = UI::Toolbar.new("Arcs") #declare the toolbar object
      cmd = UI::Command.new(("Arc-Circle: 3 Points")) { Arc3pts.tool } #create a new command object 'cmd' that launches the tool within the {}
      ...
      ...
      file_loaded?("myScript.rb")

      DB

      1 Reply Last reply Reply Quote 0
      • H Offline
        honoluludesktop
        last edited by 6 Nov 2010, 08:37

        Didier, Thanks, This will speed up access to one of my tools.

        Addenda: Wow, that was too easy to do.

        1 Reply Last reply Reply Quote 0
        • 1 / 1
        1 / 1
        • First post
          1/3
          Last post
        Buy SketchPlus
        Buy SUbD
        Buy WrapR
        Buy eBook
        Buy Modelur
        Buy Vertex Tools
        Buy SketchCuisine
        Buy FormFonts

        Advertisement