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

    .get_element_value with radio button sets

    Scheduled Pinned Locked Moved Developers' Forum
    22 Posts 6 Posters 811 Views 6 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.
    • Dan RathbunD Offline
      Dan Rathbun
      last edited by

      Reprise: Actually there are two kinds of WebDialogs that plugin authors create:

      1. A standard options dialog that has an "OK" (sometimes named "Apply") button, along with a "Cancel" button.

      This type does not apply the changes unless the user clicks the OK/Apply button.

      1. A "toolwindow" style (aka "inspector",) dialog in which the control changes take immediate effect.

      This type usually does not have buttons. The user closes the dialog when they are done by clicking the "X" button at the top-right of the window frame. Occasionally (if there is space,) a close button at the bottom of the dialog is provided. But most users would prefer such "toolwindows" to be as small as possible, as they will be floating open whilst they are working with the model.
      The latter perhaps is what Chris Phillips actually wanted, which is why he wrote the Js function to immediately return the value changes to the Ruby-side.

      So, Sam, you need to decide which of the two types you want for your plugin.

      I'm not here much anymore.

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        Dan, Since it turned out simple enough to "decode" the parameters string, I did away with the "verysimple" approach and went the conventional update on submit.

        When starting the plugin, the webdialog created has focus. Is there a way of giving the focus back to the model without having to click the wheel button?

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

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

          @sdmitch said:

          Is there a way of giving the focus back to the model without having to click the wheel button?

          No current cross-platform method in the API. It has been requested, along with onFocus & onBlur observer callbacks.

          Normally you could call in JS, %(#8000BF)[window.opener.focus()], but in the Microsoft WebBrowser Control interface, the %(#8000BF)[opener] window object is not exposed (presumably for security reasons?)

          There is no API method that currently returns a handle to SketchUp's application window either, so you cannot have the html page tell the Ruby-side that the DOM loading is complete, and have the Ruby-side set focus back to the app. This has also been requested.

          There are low-level solutions, on PC, using "Win32API.so", check the forum, ThomThom and I, and driven all discussed it. There's a topic labeled "Get Sketchup window handle" or similar.

          I'm not here much anymore.

          1 Reply Last reply Reply Quote 0
          • sdmitchS Offline
            sdmitch
            last edited by

            Dan, Just as I expected but not a big deal.

            Thanks.

            Nothing is worthless, it can always be used as a bad example.

            http://sdmitch.blogspot.com/

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

              Sam,
              T think you may want window_blur http://sketchucation.com/forums/viewtopic.php?f=180&t=49075&p=441642&hilit=.window_blur#p441398
              but maybe not...
              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
              • sdmitchS Offline
                sdmitch
                last edited by

                John, I tried the .show_modal and, just like the API said, nothing is allowed to happen as long as the WebDialog is displayed. I couldn't figure out how the hide it and then bring it back to make a change to the options selected.

                Nothing is worthless, it can always be used as a bad example.

                http://sdmitch.blogspot.com/

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

                  sorry sam, I'm on a laptop without access to all my test snippets so I pointed that one...

                  the show_modal is for my mac, works with show on PC's

                  these test are probably what I should have pointed to
                  http://sketchucation.com/forums/viewtopic.php?f=180&t=49075&p=441642&hilit=.window_blur#p441326
                  you can call focus or blur whenever you want, the dialog dosn't need to be focused to use them...
                  1ohn

                  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

                    @Sam:

                    (1) It would help if you put your OS, and SketchUp Free vs Pro, into your profile, so it appears at the left of your posts.

                    That way people would not purposely point you towards a method that was specific to an OS that your not developing on / for.

                    (2) Have another look at the example I wrote for you. It does exactly what you just described. (And uses a platform conditional statement to call the correct show method.)

                    Keep in mind you need to hold the option refs as @vars on the Ruby side, and restore them to the dialog's controls after each show (because the HTML file is reloaded.)

                    Ie.. closing the dialog with close() does not destroy it. It is still a valid object, just as it was after you created it, but before it was shown for the first time.

                    I'm not here much anymore.

                    1 Reply Last reply Reply Quote 0
                    • jolranJ Offline
                      jolran
                      last edited by

                      Hi!

                      In John/driven's example he uses dlg8.set_html(html) with a Ruby "inline" HTML codestring. That works on Mac? I thought set_html() was to be avoided?

                      So doing like that and putting in an image for button like below would work on Mac?

                      In Ruby..
                      my_icon=File.join(File.dirname(FILE), "folder/myicon_pic.png")

                      ( In the HTML wrapped something like html = %[html + js code etc...])

                      Have an image as a button:
                      <img src="#{my_icon}" width="24" height="24" onClick="jsfunction()">

                      Note, Im not using a separate Html file in this case.
                      I think Adam is doing something similar in Goldilocks, but uses URL if I remember it correct.

                      Hope I'm not hijacking the thread, thought it was relevant.

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

                        @jolran said:

                        Hope I'm not hijacking the thread, thought it was relevant.

                        Hi jolran,
                        I agree, however there's a specific thread I started on the subject http://sketchucation.com/forums/viewtopic.php?f=180&t=49338#p443472
                        try those test files on your mac... I have others as well, that work for me.
                        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
                        • thomthomT Offline
                          thomthom
                          last edited by

                          @jolran said:

                          So doing like that and putting in an image for button like below would work on Mac?

                          It used to work, then it didn't. Then it might be working for some. But not me.
                          I wouldn't rely on it.

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

                          1 Reply Last reply Reply Quote 0
                          • jolranJ Offline
                            jolran
                            last edited by

                            Ahh, I see John. If I get it right the sethtml thing is working cause of updated Mountain Lion?

                            Thomthom, I have been searching through threads where you discuss just this issue, thats why I also asked this question. Being not confident in Webdialog, the platform issues are a bit confusing sometimes. But I take your word for it and try to fix it with set_file instead.
                            Thanks.

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

                            Advertisement