Web dialog problem
-
The problem may be due to coding.
Try to remove this.(and in html)<meta http-equiv="Content-Type" content="text/html" charset="utf-8"/>
-
Thanks Sahi for your quick reply!
I removed the <meta>-tag and contents. Still the same problem.
Still the webdialog.Set_file works, the webdialog.set_html doesn't.I get this error from the console:
Error: #<NameError: undefined local variable or method
wb' for main:Object> C:/Program Files/Google/Google SketchUp 8/Plugins/mbl.rb:149:in
mbl_main'
C:/Program Files/Google/Google SketchUp 8/Plugins/mbl.rb:186I can't find the variable. I do not understand why this error is reported with the same html file/string?
Please help, thanks in advance!
Jeroen
-
string 133 ? split(",") ?
which string gets the variable msg ???
puts msg.to_s
-
Hi
It's the JS that's falling down in ruby...
if you put it in a simple WD, that works without it, you get js parsing errors from ruby with it.
some are whitespace and some are case[Case] issues
It's basically because the 'browser' parses the JS differently to ruby [which is either stricter or simply different],
you need to manually parse it for ruby, then it works for both...here's the simple WD I tested the html in...
dlg_html='put your html in here... I deleted the DATA tags first' dlg = UI;;WebDialog.new('My Dialog', true,'MyDialog', 400, 400, 150, 150, true) dlg.navigation_buttons_enabled = false dlg.set_html(dlg_html) dlg.show
john
-
Thanks for your replies!
@sahi JS returns msg with a string ("cancel") or with information about the selected items. To use the JS array I had to convert it to a Ruby array. So I used the split method.
@driven. I think I understand the problem. I unfortunately have not enough experience/knowledge to rewrite the JS part so Ruby can understand it. So I think I'll use the separate html file and wb.set_file method.
Thank you for your replies!
Jeroen
-
I'm a bit late to this discussion. Have you worked out your issue now?
In general I recommend separating the HTML into a separate file as it's easier to manage.
If you are new to WebDialogs in SketchUp I can suggest a thread I started that tries to summarize many pitfalls: http://forums.sketchucation.com/viewtopic.php?f=180&t=23445#p198883
A side note on your code snippet, I see you use
.typename
to compare entity types, something I strongly recommend you avoid. It's a big performance drain. I was just finishing up a small article on that topic: http://www.thomthom.net/thoughts/2011/12/never-ever-use-typename/ -
The error is a simple typo
Did anyone read his error message ?
line 149 he has
wb
as the webdialog object reference, instead ofwd
!!PS: this thread belongs in the Developers forum.
-
@dan rathbun said:
The error is a simple typo
It may well have the typo, but when I ran his 'working bits' in the clean wd, it also has JS issues...
@unknownuser said:
PS: this thread belongs in the Developers forum.
who can move these types of post? -
@driven said:
It may well have the typo, but when I ran his 'working bits' in the clean wd, it also has JS issues...
@unknownuser said:
PS: this thread belongs in the Developers forum.
who can move these types of post?I can. Already moved. See breadcrumb navigation over the topic title.
-
Advertisement