[Question]large_icon or relative path
-
Is there a way to get the large_icon or small_icon of an instance of UI::Command?
cmd = UI;;Command.new("Tester") { UI.messagebox("Hello World") } cmd.small_icon = "ToolPencilSmall.png" cmd.large_icon = "ToolPencilLarge.png"
command.large_icon does't work!
I have try to modify the instance_method "large_icon=" of UI::Command in a rb file like "c:/Command_.rb".
module UI class Command attr_reader ;large_icon alias_method ;old_large_icon=,;large_icon= def large_icon= (fn) @large_icon=fn old_large_icon=(fn) end end end
It works .
But tool button will be shown without icon if program uses relative path to the icon file.
Like sandboxmenus.rb in "C:/Program Files/Google/Google SketchUp 7/Tools/Sandbox".#a segment of sandboxmenus.rb cmd = UI;;Command.new($tStrings.GetString("From Scratch")) { Sketchup;;active_model.select_tool FromScratchTool.new } cmd.small_icon = "Images/tbFlatTerrainSmall.png" cmd.large_icon = "Images/tbFlatTerrainLarge.png"
It seems that "Images/tbFlatTerrainSmall.png" is treated as "c:/Images/tbFlatTerrainSmall.png" instead of "C:/Program Files/Google/Google SketchUp 7/Tools/Sandbox/Images/tbFlatTerrainSmall.png".
Advertisement