WebDialog (Mac) - style.visibility in SU6
-
I have been testing a WebDialog on Mac that uses a visibility of an object
getElemendById(id).style.visibility='hidden';For some reason SU6 fails to set the visibility. SU7 & SU8 are doing just fine.
Have anyone experienced similar problem? Is there an easy solution?
-
I'm guessing you are sending
getElemendById(id).style.visibility='hidden';toexecute_script? Then I think there are character escaping issues if I remember correctly - and it might be different from Windows to OSX.If this is not sent to
execute_script, - then I'm puzzled. -
I use following function in JS:
function ShowObject(id, flag) { var elem=document.getElementById(id); if(elem) elem.style.visibility=flag?'visible';'hidden'; }and I send
wd.execute_script("ShowObject('something', 0);")
For some reason in works on MAC in SU7&8, doesn't hide a thing in SU6(also MAC).If I understand correctly SU uses Safari in all versions of SU on Mac. Where can the difference come from? I have no clue.
-
Yea - if you test on the same machine the webdialog behaviour be the same between SU versions - which makes me think this is a ruby API bug with
execute_script.From the Lost Manual: http://forums.sketchucation.com/viewtopic.php?f=180&t=23445
@unknownuser said:
OSX
.execute_scriptand quotes
There was some issues with.execute_scriptand quotes in Sketchup prior to 7.0 on OSX. http://forums.sketchucation.com/viewtopic.php?f=180&t=8316#p49259Though that suggested an OSX only problem. You are saying it's on Windows as well?
CPhillips suggested semi-colons could be an issue: http://forums.sketchucation.com/viewtopic.php?f=180&t=8316#p49259
@cphillips said:
I tried adding a semicolon to the line above and it made no difference. In fact semicolons seem to cause problems in certain cases on Mac.
execute_script("somefunc('hello');")
Calls the javascript func with the string: "hello);" on Mac. But if I leave the semicolon off it seems to work as intended.
-
In your
ShowObject(id, flag)function, have you inspected the data it receives? -
Thanks Thomas for help.
I have checked the JS function and I have found that on SU6 the 'flag' which is either 0 or 1 was not recognized by the following code:elem.style.visibility=flag?'visible';'hidden';I decided to send 'visible' or 'hidden' instead of numbers. Now JS works fine.
I think that JS expected integers and couldn't convert strings comming from SU6?
-
with your original code, did you try a typeof test of the flag? just to see what it came across as?
did you try without semi-colon? -
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement
. Will check the old code.