Programing menu icons
-
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 -
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 objectYou 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") -
Didier, Thanks, This will speed up access to one of my tools.
Addenda: Wow, that was too easy to do.
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement