sketchucation logo sketchucation
    • Login
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download

    Changing Toolbar Image

    Scheduled Pinned Locked Moved SketchUp Feature Requests
    sketchup
    3 Posts 3 Posters 866 Views 3 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

      Lets say I've created a new command:

      @toolbar=UI;;Toolbar.new("simulation")
      @playcmd=UI;;Command.new("play"){simulation.new}
      @playcmd.small_icon=@playcmd.large_icon="buttons/run.bmp"
      @playcmd.tooltip="Start simulation"
      @playcmd.status_bar_text="Start simulation"
      @playcmd.menu_text="Start!"
      @toolbar.add_item(@playcmd)
      @toolbar.show()
      

      Is there a way to change the icon of @playcmd any time I want? >
      When I click @playcmd button I wan't its icon to change to different icon. Like at first click the icon changes to pause.bmp, and at second click I want icon to change back to run.bmp.

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

        The @playcmd is an class instance variable that only endures during that use of the class.
        Making it a @@playcmd class variable means that it's remembered for that session of Sketchup across instances of the class. You need to declare any such @@'s =nil in the body of the class code [near the start] and then set them to refer to objects within your methods etc...
        So theoretically you could [re]set the @@playcmd.small_icon() etc dynamically in response to a user clicking the button and/or the tool's @state changing etc...

        TIG

        1 Reply Last reply Reply Quote 0
        • Dan RathbunD Offline
          Dan Rathbun
          last edited by

          @tig said:

          So theoretically you could [re]set the @@playcmd.small_icon() etc dynamically in response to a user clicking the button and/or the tool's @state changing etc...

          There's no problem with changing the path to the image (no exception is raised,) it's just that the UI::Toolbar instance ignores the change. We've tried closing and opening the toolbar, but no effect.

          This is a change that needs to be implemented in the API using the relevant system calls on each platform. (I know how to do it on Windows making a Win32 call, but not on Mac.)

          So, this is a true wish... add my vote.

          I'm not here much anymore.

          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