My plugin work on Windows not on Mac
-
Hi,
I started to develop a plugin for drawing rectangular aquariums. It works well on Windows. A Mac user tells me it does not work on his Mac (webdialog window empty).
What could be the problem? I Have scrambled the main file, it may be that?Thank you.
Philippe
-
It could be a lot of things. I think you won't get much help here without providing an unscrambled version? I'm sure people can present possible ideas, but it might just be easiest to see the actual script.
-
Ok, I put an unscrambled version in file attachment. Sorry for the UI that is in French.
Thank you.
-
Empty WebDialog window might be that you're using WebDialog.set_html (Are you? I have not looked at your source yet.)
If you're new to SketchUp plugin development, I got some links that might help you:
WebDialogs: http://sketchucation.com/forums/viewtopic.php?f=180&t=23445General on developing plugins: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/
There's more articles on more specific topics on my blog there - including my et peeve, #typename http://www.thomthom.net/thoughts/2011/12/never-ever-use-typename/
-
Yes, i'm a beginner with ruby and Sketchup plugin development.
My plugin work very well on my PC but it is very weird on Mac.I use Weddialog.set_file however.
Thank you for all these links.
-
The API's
weddialog.set_file()
is known to fail...
Put simplyset_html()
fails under OSX because of a ill contrived Safari update.
Whereas usingset_url()
should work on all Platforms. -
@tig said:
The API's
weddialog.set_file()
is known to fail...?
Never had any issues with it - on any platform. Example?
-
Typo - I meant
set_html()
Doh!
Hence my reference to it in my next sentence
Still confused about how that happened... too much Rioja with my Sunday dinner -
Ahhhh ..... I know only too well that one Tinto can lead to many
-
Hi,
I replaced set_file by set_url and i have the same issue (on Mac "empty white" content in webdialog).
-
Revert to as it was - didn't you read the posts about my typo?
Without seeing exactly how you rb interacts with the html/js etc we are stuck... -
Ok I put it back like it was before.
I put the full archive of my plugin a few posts above.
-
OK.
You are typically using:
@wnd_params.execute_script("$('#longueur').val('#{s_longueur}')")
to set the 'value' ofid=longueur
to bes_longueur
Try constructing it a different way: perhaps the MAC doesn't like it: perhaps something more like:
@wnd_params.execute_script("document.getElementById('longueur').setAttribute('value','#{s_longueur}');")
???
If it's not a 'value' then try something like 'innerHTML' OR 'innerTEXT': e.g.:
@wnd_params.execute_script("document.getElementById('longueur').innerHTML='#{s_longueur}');")
etc...
-
Not near a Mac to test at the moment. But have you tried with adding ; at the end of each command you execute?
(Sidenote, if you use that script in a model with untis settings set to display feet you'll get ' characters that will break your javascript because you're no escaping your string.)
(Sitenote 2:
120.cm.to_l
the.to_l
is redundant as.cm
will return aLength
object.) -
TT, well spotted that he has missed a '
**;**
' terminating his script string - I missed that - however, it doesn't why it's PC friendly / MAC unfriendly - I recall something about MAC's changing the way 'innerHTML' / 'innerTEXT' worked a few Safari updates ago - perhaps that's the rub? -
Nah - he's using jQuery. It takes care of all compatibility issues like that. I've used jQuery for several years now and none of them has broken. Certainly not the ones he's using there.
-
First, thank you both try to help me on these issues.
Well done for small errors in my code.
I added the ";" at the end of javascript strings and i changed the code as :
@wnd_params.execute_script("$('#longueur').val(#{s_longueur.inspect});") to escape ' and " charactersI don't have a Mac at hand either. I have to wait for a Mac user have the time to try my corrections and then give me the result.
-
if I change the rubies encoding to uft8 and I zapp the gremlins I get this which shows the css for font size is not good. use ems
Advertisement