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

    Window.open webdialog on MAC close parent

    Scheduled Pinned Locked Moved Developers' Forum
    19 Posts 4 Posters 586 Views 4 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.
    • D Offline
      driven
      last edited by

      Ok,
      if I just run

      dialog = UI;;WebDialog.new("PVGYS", true, "sk_pvgys", 930,  830, 500, 0, true)
      dialog.set_url('http://re.jrc.ec.europa.eu/pvgis/apps3/pvest.php')   
      dialog.show_modal
      

      I can go to child windows and then right click to go back to the parent etc...

      I get an error for each because the request is asking for a new TAB not window, but because this WebDialog doesn't have Tabs, The new windows appear to be sized by the content.

      [@Dan, you highlight so often for so many reasons I loose track... and I tend to paste rather than read...]
      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
      • JuantxoJ Offline
        Juantxo
        last edited by

        @unknownuser said:

        What's not working

        Using javascript command "myWindow = window.open();" in Safari and IE you have two windows opened.

        But inside a webdialog this command in MAC not open a new window, only load it inside parent window. In IE works normally, and you have two windows at same time.

        I give up with this, I achieved the plugin to work in MAC whith only one window.

        Thank you all

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

          Why not just open a new WebDialog?

          Thomas Thomassen β€” SketchUp Monkey & Coding addict
          List of my plugins and link to the CookieWare fund

          1 Reply Last reply Reply Quote 0
          • JuantxoJ Offline
            Juantxo
            last edited by

            I want to open this webdialog 'http://re.jrc.ec.europa.eu/pvgis/apps3/pvest.php' and when I press "calculate" the server
            sends a response, opened in a new window (in Safari and IE), but not in MAC webdialogs.
            I only wanted to know why window.open() works differently in MAC webdialogs, nothing more.
            (I can't modify server files)

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

              Hi Jauntxo,

              The reasons for WebDialogs and Safari behaving differently [on the same machine] are two fold.

              1: WebDialogs can't and don't use Safari.app,
              Safari is a separate Apple application that also uses WebKit and WebCore frameworks.

              Sketchup UI can use Safari.app

              Safari = UI.openURL  "http://re.jrc.ec.europa.eu/pvgis/apps3/pvest.php"
              

              Opens your target in Safari.

              2: When using WebDialogs, you are being routed through Sketchup server settings.
              Sketchup generates the headers based on the best way for it to access dynamic Google Resources [SU Licensing, G Warehouse, G Earth, etc...]

              If you point WD at a dynamic site that has a different structure to the Sketchup<=>Google template your results will vary.
              Even going to the SU API pages from inside SU is problematic.

              However, the pages you want to access are nicely constructed and can be accessed and work from a Webdialog.
              The settings may vary from the ones for PC, but with a couple of slight impositions this works.

              dlg = UI;;WebDialog.new("PVGIS", true,"pvgis", 900, 930, 150, 150, true, true);
               dlg.set_url "http://re.jrc.ec.europa.eu/pvgis/apps3/pvest.php"
               dlg.min_width = 900
               dlg.min_height = 930
               dlg.max_width = 900
               dlg.max_height = 930
               dlg.set_position(150,150) 
               dlg.navigation_buttons_enabled=true
               dlg.show_modal
              

              With these settings you can do all your navigation from one window, and use the back/forward buttons for most things [Back after PDF doesn't work].
              If you are sent to a different width page, the WD will narrow, but when you grab the corner it will resize to the defined max/min settings.
              All the 'onscreen' information appears to work.
              Selecting 'Text' as output doesn't appear to work. [in a quick test], but PDF output can be saved locally from the WD.

              Hope this helps answer your query.
              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
              • JuantxoJ Offline
                Juantxo
                last edited by

                Today I finish to change Skelion plugin to run on MAC and it seems all is running ok.
                Thank you John.

                1 Reply Last reply Reply Quote 0
                • Dan RathbunD Offline
                  Dan Rathbun
                  last edited by

                  SO.. the lesson is, do not try and open a new window from the webdialog JS.. instead write a Ruby callback and fire it FROM the JS, .. and let the Ruby callback open the window using either UI.openURL or instantiating another WebDialog instance.

                  I'm not here much anymore.

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

                    @unknownuser said:

                    SO.. the lesson is, do not try and open a new window from the webdialog JS..

                    not necessarily SO..
                    Dynamic Components works fine writing new windows. SU, as both client and server allows for it.
                    Get Photo Textures can go full screen with 'Flash', because SU allows for it.

                    Creating new windows in js works, it's just needs special handling to deal with resizing.

                    If you add the back/home/forward buttons you can have multiple new windows, all packed neatly into one chrome.

                    What you can't do via 'SU as Server' is Download or Upload local content. [that's what broke set_html if html = local_file.img]

                    @unknownuser said:

                    instead write a Ruby callback and fire it FROM the JS, .. and let the Ruby callback open the window using either UI.openURL or instantiating another WebDialog

                    Curiously, in mac SU, GoogleEarth.app is controlled by an Applescript, that sets and gets contents, takes a screenshot and inserts that it back into SU.

                    I had a go an applescript version for this topics site last night that uses
                    UI.openURL to open in Safari but positioned [by script] 'as if' in SU.

                    I then manually filled in the form and downloaded the text file.

                    I then used a folder action to automatically move and rename the new file to match a WD dlg.set_file "path/text.txt" to
                    open in SU. [WD even wraps it in <pre with formating> automatically].

                    You could do the Safari stuff in the background, including filling in the form fields, requesting the calculation and download.

                    SO.. you could use SU to launch a WD1 to collate all the required input,
                    then have SU complete an Applescript with that information before running that script [in own thread] via system
                    WD1 could spin a progress bar until the new file is available.
                    then SU can launch a WD2 with the required output, closing WD1 as it opens.

                    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
                    • Dan RathbunD Offline
                      Dan Rathbun
                      last edited by

                      @driven said:

                      What you can't do via 'SU as Server' is Download or Upload local content. [that's what broke set_html if html = local_file.img]

                      Is this local content still broken on Safari ??

                      I'm not here much anymore.

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

                        @dan rathbun said:

                        @driven said:

                        What you can't do via 'SU as Server' is Download or Upload local content. [that's what broke set_html if html = local_file.img]

                        Is this local content still broken on Safari ??

                        Yes. 😞

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        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