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.
    • 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