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

    Web dialog problem

    Scheduled Pinned Locked Moved Developers' Forum
    11 Posts 5 Posters 593 Views 5 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.
    • S Offline
      sahi
      last edited by

      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"/>
      
      1 Reply Last reply Reply Quote 0
      • P Offline
        piranesi
        last edited by

        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:186

        I 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

        1 Reply Last reply Reply Quote 0
        • S Offline
          sahi
          last edited by

          string 133 ? split(",") ?

          which string gets the variable msg ???

          puts msg.to_s

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by

            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

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • P Offline
              piranesi
              last edited by

              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

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

                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/

                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

                  The error is a simple typo

                  Did anyone read his error message ?

                  line 149 he has wb as the webdialog object reference, instead of wd !!

                  PS: this thread belongs in the Developers forum.

                  I'm not here much anymore.

                  1 Reply Last reply Reply Quote 0
                  • D Offline
                    driven
                    last edited by

                    @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?

                    learn from the mistakes of others, you may not live long enough to make them all yourself...

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

                      @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.

                      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

                        @driven said:

                        @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...

                        Could be that he's using a double-quoted heredoc instead of a single-quote heredoc wrapper ??

                        I'm not here much anymore.

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

                        Advertisement