Toolbar problem in SU 8 on Windows
-
Toolbar problem in SU 8 on Windows
We are having some problems with toolbars in SU8. We load a toolbar, but we can't seem to get it to load docked (It loads OK - but always undocked).
To test it, I placed this code in a files called toolbar.rb, not in my plugins folder. (In a folder called c:\aa"
toolbar = UI;;Toolbar.new "Test2" # This toolbar icon simply displays Hello World 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 toolbar.show
When I start SU 8, and load this .rb file: load('w:/aa/toolbar.rb')
The toolbar appears, but it is undocked.
I dock it, and exit SketchUp, restart SketchUp and reload it and it still appears undocked.
Does anyone have any ideas?
-
I removed all .rb files from my plugins folder and it still doesn't work.
-
I placed similar code in a .rb file in the plugins folder and it does load properly - docked.
3 I tried docking it in different places, and it still won't come up docked.
-
This sample, from the SU API documentation references icons which don't exist. I also tried it with icons which do exist and it didn't help.
-
In SU 7 - it comes up docked the first time and every time,
Any ideas?
Note: We only seem to have this problem when loading a tool bar with a command, not if loaded when SketchUp first starts.
Could this be related to the new SU 8 feature to remember toolbar docking locations?
-
-
@al hart said:
We are having some problems with toolbars in SU8. We load a toolbar, but we can't seem to get it to load docked (It loads OK - but always undocked).
By design - a method to avoid the toolbar shuffle as new toolbars that inserted them selves docked to a toolbar would throw everything else around.
-
@thomthom said:
@al hart said:
We are having some problems with toolbars in SU8. We load a toolbar, but we can't seem to get it to load docked (It loads OK - but always undocked).
By design - a method to avoid the toolbar shuffle as new toolbars that inserted them selves docked to a toolbar would throw everything else around.
Thanks for helping with this ThomThom.
That would make sense the first time we loaded the new toolbar, but if the user docked it and exited SketchUp, then the user would hope it reloaded into the same place the next time he/she ran SketchUp.
Also, the .rb file in the plugins folder did load into the docked area the first time. Only the .rb file loaded after starting SketchUp always loads undocked.
We're going to release our SU 8 versions with this bug as is.
We will try registering the application properly as an Extension and see if that helps. (We have not done that yet).
We are running around in circles this morning, because a "bug fix" in Ruby 1.8.6 made it an error to convert a 32-bit number (such as the SketchUp color white) into a signed integer. It can only be converted into an unsigned integer. So we are recompiling and testing everything for SU 8.
-
Oh?
It doesn't remained docked? It should. It's just the very initial run where it starts out undocked instead of docked.Mind you - I still have issues with toolbars shuffling.
-
Take an example from the Google supplied Tools.
They do the following at the end of their scripts:
# Show toolbar if it was open when we shutdown. state = toolbar.get_last_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. UI.start_timer(0.1, false) { toolbar.restore } end
That should work because it does for me with the Google ruby toolbars, ie: SolarNorth, DynamicComponents, etc. The above snippet is right out of one of these files, without modification.
. -
Has that been there since SU8? Or earlier? It'd be odd if it is earlier since the timer was bugged in pre-SU8...
-
@thomthom said:
Has that been there since SU8? Or earlier? It'd be odd if it is earlier since the timer was bugged in pre-SU8...
Yea.. I guess it's new. The ver7 Sandbox loader script does not have the UI.timer delay, but the SU8 version does.
-
And they, once again, made changes to the files, without bumping up the version number(s).
-
Or making notes in the public API docs...
-
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.
-
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 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. -
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
~ -
@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.
-
@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
AThe 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 -
I get no such errors in 7 or 8.
-
@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 said:
i suspect it is because you can't set a timer to less that a full second.
You can now in SU8!
-
@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"
Advertisement