sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Changing Command Icons of the Toolbar

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 7 Posters 3.1k Views 7 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.
    • Rich O BrienR Offline
      Rich O Brien Moderator
      last edited by

      You can even edit toolbars that come with ridiculous number of icons like this one to have less icons.

      As for changing icons, you simply do as Jeff says, pick your desired new icon as same it in the same location with the same name and size (24px x 24px or 16px x 16px)

      Here's my custom Extrusion Toolset toolbar with less options and different icons...
      Icons.png

      Download the free D'oh Book for SketchUp πŸ“–

      1 Reply Last reply Reply Quote 0
      • A Offline
        Anton_S
        last edited by

        No u didn't get it, I want to toggle between two or more icon images in the same command button. Like toggling between play and pause icon images. Ex: Click play icon changes to pause image, then click again icon changes back to play image. Is there a way for that?

        1 Reply Last reply Reply Quote 0
        • jeff hammondJ Offline
          jeff hammond
          last edited by

          @anton_s said:

          Is there a way for that?

          oh.. in that case, i don't know.

          ask one of these guys ---> πŸ€“

          [fwiw, i've never seen the behavior before but who knows..]

          dotdotdot

          1 Reply Last reply Reply Quote 0
          • A Offline
            Anton_S
            last edited by

            Hay, thanks >>>>>>>>>>>>> I will!!!!!!!!!!!!!
            And by the way nice Pen tool, It's much more comfortible to use them!!!! Thanks!!!

            1 Reply Last reply Reply Quote 0
            • jeff hammondJ Offline
              jeff hammond
              last edited by

              @anton_s said:

              Hay, thanks >>>>>>>>>>>>> I will!!!!!!!!!!!!!

              well, hopefully, they'll come along and see the question..

              you might have a better chance of the right people seeing your question in the developer's forum instead of the newbies section.

              dotdotdot

              1 Reply Last reply Reply Quote 0
              • M Offline
                Mr.K.1
                last edited by

                Well I tested a couple of ideas on this and it doesn't seem to work, Ruby has very limited reach into SU tool/menu system so you can only really add things and not change them once that is done.

                You could do a little cheat by making two identical toolbars then hide the first and show the second, and vice versa.
                But again Ruby has no control over how the toolbars are positioned so it may end up being a silly jumping button.

                1 Reply Last reply Reply Quote 0
                • TIGT Offline
                  TIG Moderator
                  last edited by

                  If you create your toolbar within the tools module/class and then refer to the definition of the command as class variable - e.g.
                  @@cmdA=UI::Command.new("MyToolA"){Sketchup.active_model.select_tool(MyModule.MyToolA.new())} @@cmdA.small_icon=File.join(File.dirname(__FILE__),"MyImages","myToolA_Green.png")
                  etc... then as circumstances change the image file that's used...
                  @@cmdA.small_icon=File.join(File.dirname(__FILE__),"MyImages","myToolA_Red.png")
                  etc...
                  You can therefore have your various tool-commands permanently referenced as @@cmdA, @@cmdB etc and swap their icons, tooltips and so on, as circumstances change...
                  πŸ€“

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • A Offline
                    Anton_S
                    last edited by

                    Thanks TIG, but I already tried that way and it didn't work after the command was added to the toolbar, u can refer to the Mr.K post above.

                    1 Reply Last reply Reply Quote 0
                    • TIGT Offline
                      TIG Moderator
                      last edited by

                      @anton_s said:

                      Thanks TIG, but I already tried that way and it didn't work after the command was added to the toolbar, u can refer to the Mr.K post above.

                      It will change ToolTips etc so perhaps if you hide/show the toolbar ? πŸ˜•

                      TIG

                      1 Reply Last reply Reply Quote 0
                      • M Offline
                        Mr.K.1
                        last edited by

                        Ya I tried this several ways, text does change but the icons never do(hide, show, remove toolbar and add it again nothing changes).
                        It seems SU only loads those images once and they can't be refresh through Ruby.

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          Yup. Seems that only the tooltip in the Command objects are actually linked to the toolbar objects it represent. The rest seem to be forgotten. 😞

                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • TIGT Offline
                            TIG Moderator
                            last edited by

                            Bum! 😞
                            The best you could do then for something like a 'Play' > 'Stop' button is to have two buttons side by side, with one disabled [grayed-out] if the other one is enabled - using a validation_proc...

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • thomthomT Offline
                              thomthom
                              last edited by

                              @tig said:

                              Bum! 😞
                              The best you could do then for something like a 'Play' > 'Stop' button is to have two buttons side by side, with one disabled [grayed-out] if the other one is enabled - using a validation_proc...

                              Or for Play/Stop, just make the Play button pressed or not pressed - using MF_CHECKED and MF_UNCHECKED.

                              Thomas Thomassen β€” SketchUp Monkey & Coding addict
                              List of my plugins and link to the CookieWare fund

                              1 Reply Last reply Reply Quote 0
                              • A Offline
                                Anton_S
                                last edited by

                                @thomthom said:

                                @tig said:

                                Bum! 😞
                                The best you could do then for something like a 'Play' > 'Stop' button is to have two buttons side by side, with one disabled [grayed-out] if the other one is enabled - using a validation_proc...

                                Or for Play/Stop, just make the Play button pressed or not pressed - using MF_CHECKED and MF_UNCHECKED.

                                Yeah Thanks!...
                                This would not be a bad idea.
                                I think changing toolbar icons should be part of SU 9 wishes. πŸ˜„

                                1 Reply Last reply Reply Quote 0
                                • M Offline
                                  maricanis
                                  last edited by

                                  I've found this rather old topic, and have a question is it possible now to change toolbar icons.

                                  I would like to change tool icon when some variable (@@active_extension) is changed.

                                  [ruby]@@activateCmd.set_validation_proc(){
                                    puts "Active #{@@active_extension}"
                                    puts "before #{@@activateCmd.small_icon}"
                                    if @@active_extension == 'ext1'
                                      @@activateCmd.small_icon = File.join(icons_dir,"ext1_16.png")
                                      @@activateCmd.large_icon = File.join(icons_dir,"ext1_24.png")
                                    elseif @@active_extension == 'ext2'
                                      @@activateCmd.small_icon = File.join(icons_dir,"ext2_16.png")
                                      @@activateCmd.large_icon = File.join(icons_dir,"ext2_24.png")
                                    end
                                    puts "after #{@@activateCmd.small_icon}"
                                    MF_ENABLED
                                  }[/ruby]
                                  

                                  This part of code validates command and prints correct icon path (which is changed in accordance with @@active_extension variable), but tool image in toolbar is not updated.

                                  I've also tried to put this change not in set_validation_proc(), but in code after variable is changed. Again correct values are printed, but image remains the same.

                                  Thanks in advance,
                                  Marija

                                  1 Reply Last reply Reply Quote 0
                                  • A Offline
                                    Anton_S
                                    last edited by

                                    Hi Marija, I just tested changing icons on SU2016, on Windows OS, and it still doesn't work.

                                    1 Reply Last reply Reply Quote 0
                                    • M Offline
                                      maricanis
                                      last edited by

                                      Thanks Anton,
                                      I was thinking, that I'm doing something wrong, but it seems that this behaviour is not changed yet.

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

                                      Advertisement