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

    Toolbar problem in SU 8 on Windows

    Scheduled Pinned Locked Moved Developers' Forum
    27 Posts 4 Posters 2.0k Views 4 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.
    • Al HartA Offline
      Al Hart
      last edited by

      Is there a place to report bugs such as this?

      And/or are they worth reporting?

      I suspect I would have gotten a better response if I had discovered the bug and reported it during Bets testing.

      Our problem here is that we like to let the user choose and load one of 4 toolbars for our rendering product - depending on which one they want to run - so it is tricky to load the toolbar while SketchUp is loading, (which seems to avoid the problems), but rather to let the user choose which toolbar to load from the plugins menu.

      Al Hart

      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
      IRender nXt from Render Plus

      1 Reply Last reply Reply Quote 0
      • Al HartA Offline
        Al Hart
        last edited by

        The timer did not help.

        Thanks for the idea, Dan.

        It is interesting that I get a warning when starting the timer:

        /aa/toolbar.rb:32: warning: Float 0.1 out of range

        SU 7 does not give the warning.

        Has anyone tried my code (You do not actually need any .PNG files) and/or does anyone have a small .rb which I can load from a directory, rather than putting in plugins to see what it does?

        Latest code:

        
         toolbar = UI;;Toolbar.new "Test2"
         # This toolbar icon simply displays TestX on the screen
         cmd = UI;;Command.new("Test2") { 
           UI.messagebox "Test2"
         }
         cmd.small_icon = "ToolPencilSmall.png"
         cmd.large_icon = "ToolPencilLarge.png"
         cmd.tooltip = "Test Toolbars"
         cmd.status_bar_text = "Testing the toolbars class"
         cmd.menu_text = "Test2"
         toolbar = toolbar.add_item cmd
        
         cmd = UI;;Command.new("Test3") { 
           UI.messagebox "Test3"
         }
         cmd.small_icon = "ToolPencilSmall.png"
         cmd.large_icon = "ToolPencilLarge.png"
         cmd.tooltip = "Test Toolbars"
         cmd.status_bar_text = "Testing the toolbars class"
         cmd.menu_text = "Test3"
         toolbar = toolbar.add_item cmd
         toolbar.show
        
          # Show toolbar if it was open when we shutdown.
          state = toolbar.get_last_state
        printf("toolar state; %s\n", state)
          if (state == TB_VISIBLE)
            toolbar.restore
            # Per bug 2902434, adding a timer call to restore the toolbar. This
            # fixes a toolbar resizing regression on PC as the restore() call
            # does not seem to work as the script is first loading.
        printf("Starting timer\n")
            UI.start_timer(0.1, false) {
              toolbar.restore
            }
        printf("After Starting timer\n")
          end
        
        

        Result in SU 8:

        load '/aa/toolbar.rb'
        /aa/toolbar.rb:33: warning: Float 0.1 out of range
        toolar state: 1
        Starting timer
        After Starting timer
        true

        Al Hart

        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
        IRender nXt from Render Plus

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

          Error 404 (Not Found)!!1

          favicon

          (sketchup.google.com)

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

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

            @al hart said:

            /aa/toolbar.rb:32: warning: Float 0.1 out of range

            SU 7 does not give the warning.

            The new core is more strict - the warning is probably because 0.1 suffers from rounding errors.

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

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

              Just when I was about to say, I was having no problems with Toolbars... I opened SU8 and got a toolbar shuffle for no apparent reason.

              Anyway.. I turned off the Google toolbar.. and put the Sandbox toolbar where it was (last on the 1st row.)
              Then I used the menu option "Save Toolbar Positions"
              Then closed SU8
              Then reloaded SU8 and it was where I put it.

              But, I'm very sure that I had not ever opened the Sandbox Ruby toolbar, and when I did, by checking the box in the Extensions panel, it just docked at the end of TB row 2, instead of floating.

              So things are not right still in Sketchup Octoland...

              ... and Al, I do not get that float range error when running SU8 with Ruby v 1.8.7-p299

              I'll try it in a min, with v 1.8.6-p287
              ~

              I'm not here much anymore.

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

                @dan rathbun said:

                So things are not right still in Sketchup Octoland...

                Yes! I'm not mad!

                But like you, I've been able to determine any pattern. I've pretty much settled on SU's Toolbar system being FUBAR.

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

                1 Reply Last reply Reply Quote 0
                • Al HartA Offline
                  Al Hart
                  last edited by

                  @thomthom said:

                  The new core is more strict - the warning is probably because 0.1 suffers from rounding errors.

                  i suspect it is because you can't set a timer to less that a full second.

                  I get the same error with 0.5, which shouldn't have any rounding errors:

                  UI.start_timer(0.5, false) {puts "A" }
                  (eval): warning: Float 0.5 out of range
                  20984
                  A

                  The message is even stranger when you pass if 2.0/10.0

                  UI.start_timer(2.0/10.0, false) {puts "A" }
                  (eval): warning: Float 2.0 out of range
                  20928
                  A

                  Al Hart

                  http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                  IRender nXt from Render Plus

                  1 Reply Last reply Reply Quote 0
                  • J Offline
                    Jim
                    last edited by

                    I get no such errors in 7 or 8.

                    Hi

                    1 Reply Last reply Reply Quote 0
                    • Al HartA Offline
                      Al Hart
                      last edited by

                      @dan rathbun said:

                      ... and Al, I do not get that float range error when running SU8 with Ruby v 1.8.7-p299

                      ~

                      The error is elusive, so it may be occurring when you run another script, but you can't see it.

                      How do you change the ruby version used internally by SketchUp?

                      Al Hart

                      http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                      IRender nXt from Render Plus

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

                        @al hart said:

                        i suspect it is because you can't set a timer to less that a full second.

                        You can now in SU8! 😄

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

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

                          @al hart said:

                          How do you change the ruby version used internally by SketchUp?

                          On the PC it's only a matter of renaming (for backup,) the old one from "msvcrt-ruby18.dll" to "msvcrt-ruby186-p287.dll"

                          Then go get another DLL from a higher patch level and/or branch and copy it into the SU folder. Most thsoe in the 1.8.x family are named "msvcrt-ruby18.dll", but the newer ones in 1.9.x have all 3 numbers in the file name. (ie: "msvcrt-ruby191.dll")
                          Sketchup is hardcoded to look for "msvcrt-ruby18.dll"

                          I'm not here much anymore.

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

                            Very strange... Al you may want to see if a plugin overrode UI.start_timer, by dumping a methos list: UI.methods.sort
                            look for a "old_start_timer etc.

                            Or set $VERBOSE=trueand open the console before anyother rubies load.
                            When a method gets overriden, Ruby issues a warning to the console.
                            You can use a script snippet I posted: http://forums.sketchucation.com/viewtopic.php?f=180&t=30539#p269522

                            I'm not here much anymore.

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

                              @dan rathbun said:

                              Very strange... Al you may want to see if a plugin overrode UI.start_timer, by dumping a methos list: UI.methods.sort
                              look for a "old_start_timer etc.

                              I'm also seeing warnings like Al reports.

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

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

                                Well then maybe you both dump a plugins Dir listing and compare.

                                I have Google Tools: DCs, Sandbox, SolarNorth, and Photo(Web)Textures loaded.
                                3rd party Plugins: only Fredo's BezierSpline1.4, Smustard Organizer and my ver2ofOceanModeling.

                                ( It occurs to me that you guys might not have the correct Win32API.so file for v1.8.6-p287,
                                I remember having some problems with and old copy of Win32API.so, when I first started using v1.8.6 with SU7. )

                                Here's the 2 so files distro'd with v1.8.6-p287:


                                v186_p287_so.zip

                                I'm not here much anymore.

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

                                  @thomthom said:

                                  I'm also seeing warnings like Al reports.

                                  On XP or Vista ??
                                  .

                                  I'm not here much anymore.

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

                                    Windows7

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

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

                                      @al hart said:

                                      The timer did not help. Thanks for the idea, Dan.
                                      ...

                                      Has anyone tried my code (You do not actually need any .PNG files) and/or does anyone have a small .rb which I can load from a directory, rather than putting in plugins to see what it does?

                                      Latest code:

                                      
                                      >  toolbar = UI;;Toolbar.new "Test2"
                                      >  # This toolbar icon simply displays TestX on the screen
                                      >  cmd = UI;;Command.new("Test2") { 
                                      >    UI.messagebox "Test2"
                                      >  }
                                      >  cmd.small_icon = "ToolPencilSmall.png"
                                      >  cmd.large_icon = "ToolPencilLarge.png"
                                      >  cmd.tooltip = "Test Toolbars"
                                      >  cmd.status_bar_text = "Testing the toolbars class"
                                      >  cmd.menu_text = "Test2"
                                      >  toolbar = toolbar.add_item cmd
                                      > 
                                      >  cmd = UI;;Command.new("Test3") { 
                                      >    UI.messagebox "Test3"
                                      >  }
                                      >  cmd.small_icon = "ToolPencilSmall.png"
                                      >  cmd.large_icon = "ToolPencilLarge.png"
                                      >  cmd.tooltip = "Test Toolbars"
                                      >  cmd.status_bar_text = "Testing the toolbars class"
                                      >  cmd.menu_text = "Test3"
                                      >  toolbar = toolbar.add_item cmd
                                      >  toolbar.show
                                      > 
                                      >   # Show toolbar if it was open when we shutdown.
                                      >   state = toolbar.get_last_state
                                      > printf("toolar state; %s\n", state)
                                      >   if (state == TB_VISIBLE)
                                      >     toolbar.restore
                                      >     # Per bug 2902434, adding a timer call to restore the toolbar. This
                                      >     # fixes a toolbar resizing regression on PC as the restore() call
                                      >     # does not seem to work as the script is first loading.
                                      > printf("Starting timer\n")
                                      >     UI.start_timer(0.1, false) {
                                      >       toolbar.restore
                                      >     }
                                      > printf("After Starting timer\n")
                                      >   end
                                      > 
                                      

                                      Just noticed a few boo-boos when rereading this old post.

                                      (1) The statement toolbar.show (on line 22 of the snippet,) defeats the state/restore block that follows.

                                      (2) The state/restore conditional block would only work on the second toolbar "Test3" (otherwise you need a state/restore block after defining each toolbar, if you are going to keep reusing the same reference, in this case the identifier toolbar.)


                                      My latest recommended snippet is in this post:
                                      Re: How to use the toolbar.show method

                                      ******* You could wrap the snippet in a method block called:
                                      toolbar_restore(toolbar)
                                      and then pass each toolbar reference to the method after creation, so as to make your code more "clean". (Also vars delay and state will be local to the method and get cleaned up automatically.)
                                      ~

                                      I'm not here much anymore.

                                      1 Reply Last reply Reply Quote 0
                                      • Al HartA Offline
                                        Al Hart
                                        last edited by

                                        We are still struggling with Toolbars in SU8.

                                        Our biggest remaining problem, is that that when we load a plugin by hand, rather than having it loaded automatically as SketchUp loads - (we offer both options to users - always load the app, or manually load it from the Plugins menu) - the toolbar appears - but is not docked.

                                        I looked at your code snippet in the other thread, but it is hard to figure out how to put everything together.

                                        Can you, (or someone), provide a .RB which I can execute manually, (not placing it in the plugins folder - but loading the .RB from the ruby console - or later from the Plugins menu), which creates a new toolbar, and docks it properly?

                                        Then I can grab from it what I need, etc. to get it to work with our app.

                                        Al Hart

                                        http:wiki.renderplus.comimageseefRender_plus_colored30x30%29.PNG
                                        IRender nXt from Render Plus

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

                                        Advertisement